in reply to select() on a client and server socket
Is the goal to have a single connection to the other server and multiple connections to clients, i.e. a multiplexer? If so, I would think that you wouldn't want to create a new Server object when you get a new connection from a client. Instead, you should add the new client connection into the select object. You seem to be set up this way since you have for $socket (@ready){, but from your description, my guess is that you added $extsock to the select object elsewhere.
If you want multiple Server objects, you will need to give them control so that they can run their loop, most likely by calling fork or by calling the method that contains the code you listed. In that case, you would likely want to change the while to an if so that you don't block.
All that aside, assuming that you insert all clients into the @clients array, your "unknown data" should be from $extsock. This is easy enough to check:
I've been doing a *lot* of this kind of stuff lately, so if you can describe your goals in a little more detail, I can probably give you some code to help you out.if ($socket == $extsock){ print "Got data from extsock\n"; } else { print "Got data from an unknown handle ($socket)\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: select() on a client and server socket
by amir (Sexton) on Jul 11, 2001 at 20:49 UTC |