There's more than one way to do things | |
PerlMonks |
Re: Re: select() on a client and server socketby amir (Sexton) |
on Jul 11, 2001 at 20:49 UTC ( [id://95759]=note: print w/replies, xml ) | Need Help?? |
I am writing a chat/instant messaging server. Normal chat clients connect to the server to chat, so for them I need to create an object to sustain their state, info, etc. The problem is when I try to connect two servers together, so that one server connects to the other and they can pass chat messages across. Scenario: server1, server2 The admins of server1 and server2 want to join their chat servers, and make it a chat network. Both servers are listening for connections from chat clients. server1 makes a socket connection to server2. This socket will be used to pass chat messages from one server to the other. In this case server1 has to listen on its server socket and the other socket it has created, whereas server2 is only listening on its server socket. In server1's scenario, I add the connection to the other server to select from inside a Server object. OK, I know now how to figure out where the data is coming from (server1's server socket or server1's connection socket to server2). I have this code: AFAIK, the above code should block until it comes across a socket that is either readable or writeable.
In Section
Seekers of Perl Wisdom
|
|