Zed_Lopez has asked for the wisdom of the Perl Monks concerning the following question:
I've set up a pretty generic bidirectional client (straight out of the Perl Cookbook, recipe 17.10) and forking server (using IO::All). Both sides use IO::Socket (IO::All is providing a front end to IO::Socket here.)
I'd like to able to terminate a client, and have a later instance of the client reconnect to a specific child process of the original server that the previous instance had been connected to.
My best thought so far is that I need to have the server child process open a socket on a new port, pass the port # back to the client, and close the old port; when the child gets the new port number, it closes the old socket, and opens a new one on the new port, storing the port # where later instances of itself can get to it.
Is there a smarter way to do this? Could it be done leaving the parent and children servers on one port and having the parent somehow magically forward its connection to a specific child based on info the child had previously passed back to the client?
Sorry for the vagueness of the questions -- I'm new to socket programming and trying to learn what's possible.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reconnecting to a specific child of a forking server
by Fletch (Bishop) on Aug 16, 2004 at 13:14 UTC | |
|
Re: Reconnecting to a specific child of a forking server
by ikegami (Patriarch) on Aug 16, 2004 at 16:06 UTC | |
by Zed_Lopez (Chaplain) on Aug 16, 2004 at 18:51 UTC | |
|
Re: Reconnecting to a specific child of a forking server
by dws (Chancellor) on Aug 16, 2004 at 17:39 UTC |