subsitution for rcmd -> local command

This is a discussion on subsitution for rcmd -> local command within the Linux Programming forums, part of the Platform Specific Boards category; hi everyone, I m looking for a subsitution for rcmd(). i want make a client server application run on a ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    3

    Question subsitution for rcmd -> local command

    hi everyone,

    I m looking for a subsitution for rcmd(). i want make a client server application run on a standalone machine.

    currently i am going with unix file sockets to replace rcmd() for creating a scoket connection.

    my doubts are:
    1. is there only one stdin, stdout and strerr sockets for a linux machine or if we open different termnals then will those terminals have their own stdin, stdout, stderr soket descriptors

    2. Is it possible for a program running in one terminal to copy the standard io descriptors of other terminal.

    3.can a program runnin in one terminal send data to the stdin descriptor of other terminal


    i tried doing it but the parent prints the data in its own terminal not in client terminal

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    You can invoke processes on a remote machine and display their output on the client terminal by using ssh or rsh:

    Code:
    system("ssh username@hostname /path/to/command");
    Or for rsh:

    Code:
    system("rsh hostname -l username /path/to/command");

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    3
    Thanks

    but the system is a blocking call and usin ssh or rsh wont help.,.

    actually what i ws lookin for ws the exact opposite of rcmd something like local command.

    as i have an server client program which i want to run on a standalone machine.

    so finally got sucessful

    what i did is created a UNIX file socket betwwen a server and a client program, and then on the client side closed the sdtin and sdtout descriptors and dupped then to the socket descriptor which i have created so now i dont need to change anythin else in my code .

    so what i hv learned is

    1. if u want to take out the network part in some server client application use unix file socket

    2. if lookin for rcmd subsitute, somethin lik lcmd just do whatever i did.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. cout -> terminal command
    By Muscovy in forum Linux Programming
    Replies: 1
    Last Post: 07-04-2009, 03:50 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Outlook: rules not on exchange --> but local --> but how?
    By gicio in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-31-2002, 11:47 AM
  5. Command: $ cb file1.c > file2.c
    By hchuan in forum C Programming
    Replies: 2
    Last Post: 09-19-2001, 10:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21