Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, I want to have a program running on Machine A as daemon mode, another program will ask this program about some information from Machine B. Wish protocol to ...
  1. #1
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078

    connect two programs on two different machines

    Hi all,

    I want to have a program running on Machine A as daemon mode, another program will ask this program about some information from Machine B. Wish protocol to use ? anybody has an example how to do this, i used to connect two applications on the same machine using DBus, but i've never done the connection between two machines.

    by the way it's a C program.

    Please Help.

    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

  2. #2
    __D
    __D is offline
    Just Joined!
    Join Date
    Jul 2008
    Posts
    2
    The best method that I know for processes on separate computers to communicate is through sockets. The daemon will run as a server--listening for socket connections and accepting them. The other will run as a client--connecting to the server. Hereafter, the methods to send and receive data are applicable by both processes. This may seem complicated, but its not that bad. Here is the best tutorial I have found: Beej's Guide to Network Programming

  3. #3
    Linux Newbie
    Join Date
    Feb 2008
    Location
    Bangalore, India
    Posts
    112
    netcat is a simple unix utility which reads and writes data across network connections.

    In the simplest usage, "nc host port" creates a TCP connection to the given port on the given target host. Your standard input is then sent to the host, and anything that comes back across the connection is sent to your standard output.

    Code:
    nc localhost port
    - nilesh
    bigunix.blogspot.com
    Registered Linux User: #476440

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...