communication between forks

This is a discussion on communication between forks within the C Programming forums, part of the General Programming Boards category; hi quick question can you communicate variubles between forks and if so how...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    38

    Cool communication between forks

    hi quick question

    can you communicate variubles between forks and if so how

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    Inter-Process Communication (IPC) techniques are what you're interested in.

    This looks like some decent documentation on IPC in Linux: http://tldp.org/LDP/lpg/node7.html

    gg

  3. #3
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by Codeplug View Post
    Inter-Process Communication (IPC) techniques are what you're interested in.

    This looks like some decent documentation on IPC in Linux: http://tldp.org/LDP/lpg/node7.html

    gg
    Good resource.

    I'd encourage the OP to start with simple pipes.

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    38

    Question thanks for that next problem

    how about taking a recived message and reading the ip address from it.

    agein is it possible and how is it done

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by kaijuu View Post
    how about taking a recived message and reading the ip address from it.

    agein is it possible and how is it done
    Where is this message recieved from, and what do you want to send it to?

    It sound like you would be better of using threads than forking [generally that is the better solution, but not always].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    38
    ok i got the forking thing to work, i broadcast between a few servers to find a file. if a server has the file it replies to the broadcast but i need to find out the ip address for that replying server from the message is it possible?
    the next stage will be to use that ip address to create a tcp connection and transfering the file

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm sure it's possible, but I still think this is a typical "threads rather than forks" task.

    Either way, I'm sure that the simplest solution is for the server to just add it's own IP address to the message when it responds to the broadcast - after all, the server must know who it is, right? [And don't worry about the extra data, it's only 4 bytes if you do it right].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unkown Hang
    By Bladactania in forum C Programming
    Replies: 31
    Last Post: 04-22-2009, 09:33 AM
  2. Communication between programs?
    By johny145 in forum Windows Programming
    Replies: 3
    Last Post: 06-01-2005, 10:14 PM
  3. Looking for communication lib
    By BrownB in forum C Programming
    Replies: 3
    Last Post: 04-27-2005, 10:01 AM
  4. forks and children
    By suigeneris in forum C Programming
    Replies: 1
    Last Post: 01-22-2005, 04:48 AM
  5. Serial communication packets
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 04-26-2003, 08:33 AM

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