in reply to Multiple clients to one server
That loop is where every now connection is accepted, and it's up to you to manage fresh connections. If the second connection arrives while you are still processing your loop, the sync packet will be kept waiting. Once you call accept, the SYN-ACK packet will be sent to a client. If you wait too long, the TCP timout will take place, and the connection won't be established. Note that by default, accept blocks until there is a connection it can accept.my $sock=IO::Socket::new(.....); while (my $conn=$sock->accept) { # do something with $conn }
On the other hand, the cases where your program gets executed many times are when your program is running from inetd - but in that case, your program would read and write STDIN and STDOUT and would not have to deal with IO::Socket.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Multiple clients to one server
by Anonymous Monk on Apr 06, 2004 at 13:47 UTC |