Thread: c program : using pipes to communicate with other program

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    6

    c program : using pipes to communicate with other program

    Hi,

    i am trying to invoke another application (putty.exe) from my c program (OS-Windows XP) I am using TC++ complier..

    Problems:
    1. how can i pipe putty.exe from my program
    2. any link on the internet or any book that explains the functions in process.h header file in detail..

    One more thing.. can any one tell me which is the best comiler to use if i am using windows xp os and want to do network/socket and pipe programming ... i feel TC++ does not support most of what i want to do

    Thanks.
    Last edited by PUBBY; 07-27-2007 at 06:12 AM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What are ACTUALLY trying to achieve?

    Perhaps something like this will work:

    putty mymachine|myapp

    or
    myapp|putty mymachine

    ?

    --
    Mats

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    6
    Ok... I am writing a program which can actually invoke a shell script remotly in Unix servers.

    Problems:

    1. I have around 14 unix servers and the details(IP,Login credentials) of these servers are present in a CSV file
    2. I used to manually login to these servers using putty (as the protocol is ssh and not telnet) and start the shell scripts. Now i am trying to write a program which can automate this task.
    3. I have written batch files to do this but error handling (such as wrong passwords... ) becomes a problem with batch files.

    My approach:

    1. Write a program that can talk to putty.exe/plink and get the task done.

    In order to achieve this, I need to use pipes and I have problems doing this with TC++.

    or am I expecting too much from C ???
    Last edited by PUBBY; 07-27-2007 at 08:28 AM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Better compiler choices.
    http://en.wikipedia.org/wiki/Dev-C%2B%2B

    http://en.wikipedia.org/wiki/Visual_Studio_Express
    You'll also need the platform SDK which it talks about (and links to).

    You certainly don't want that old DOS-based compiler from yester-year.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    6
    Thanks Salem !.. i will look into it and get back...

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by PUBBY View Post
    Ok... I am writing a program which can actually invoke a shell script remotly in Unix servers.
    Do these things run regularly? Any reason you can't just use cron?

    Centralized control over a bunch of UNIX scripts from a... Windows box seems pretty unusual.

    EDIT: By the way, Putty can ALREADY do what you want (launch a command on a remote host automatically). I'm not going to say how. Read the documentation.
    Last edited by brewbuck; 07-27-2007 at 09:19 AM.

  7. #7
    Registered User
    Join Date
    Jul 2007
    Posts
    6
    1.These scripts (Running on Unix box) are used to monitor server satistics during a load test (started before the start of load test and killed when done).
    Unfortunately, these load tests are not scheduled.

    2.They just collects cpu and memory utilization values and puts them in a csv, which are later retrieved and graphs are generated.

    3. Load tests are started from windows machines and servers to be monitored are Unix.
    Last edited by PUBBY; 07-27-2007 at 09:38 AM.

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Can't this be done in batch-script?

    --
    Mats

  9. #9
    Registered User
    Join Date
    Jul 2007
    Posts
    6
    Yes.. it can be but..

    1. Error handling part such as wrong passwords.. etc will be a problem.. In case the password has expired, the batch file just ignores and moves to the next server..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. communicate with already opened program
    By TriKri in forum C Programming
    Replies: 2
    Last Post: 06-14-2008, 03:21 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM