XP is just a number | |
PerlMonks |
TCP Client and Server Inter process communicationby askii (Novice) |
on Jun 11, 2010 at 13:21 UTC ( [id://844236]=perlquestion: print w/replies, xml ) | Need Help?? |
askii has asked for the wisdom of the Perl Monks concerning the following question:
I am well versed in perl and have built many TCP clients and servers separately which have worked very well. I am now in a position, after much reading needing someone much wiser than I to put the two together. My problem is as follows TCP Client -> Connects to a remote end and maintains the connection. It talks a protocol and has keep alives within it. This works well and is based on IO::Socket and IO::Select modules of which there are many examples. TCP Server -> Recieves TCP connections and handles data correctly. Again simple enough and I have a forking model so multiple connections can be handled as needed. Now the problem I face is that the TCP Server needs to send data to the TCP Client in a non blocking manner, such that the TCP Client connection to a remote server must be maintained but it must recieved data from the TCP Server, when available. So little ASCII art to help TCP Client -> Connection to a remote end ^ | TCP Server <- Receives TCP connections and handles data and should send the data to the TCP Client, while the TCP Client maintains the connection to the remote end. My current code tried to combine the two, uses pipe for reading writing, however I am stuck as how to manage the select between the TCP Client to the remote server and the incoming data from the TCP Server, so they do not block each other. It is also requirement for the TCP Server to handle multiple requests, so forking not a problem, but how those processes talk to the TCP Client, without blocking etc. I am sure this is a fairly simple implementation however IPC is something I have not done in anger before and pointers welcome/required. I have not posted code directly but can provide if needed. A
Back to
Seekers of Perl Wisdom
|
|