accept() returns a new socket that is connected with the remote client. You still have your original socket that you were listening on. When you are done with this client, close his socket. The rest of your sockets will remain intact.
---
print map { my ($m)=1<<hex($_)&11?' ':'';
$m.=substr('AHJPacehklnorstu',hex($_),1) }
split //,'2fde0abe76c36c914586c';
| [reply] [d/l] [select] |
How do you close the socket? I'm trying to $client->shutdown(2); but the client is still staying connected.
| [reply] |
---
print map { my ($m)=1<<hex($_)&11?' ':'';
$m.=substr('AHJPacehklnorstu',hex($_),1) }
split //,'2fde0abe76c36c914586c';
| [reply] [d/l] [select] |
just exit; in the child process. | [reply] [d/l] |
This is not right. Yes, after you exit, the socket will be closed eventually, but there is a delay. Some time it takes couple of muinutes for the local port to be freed up, and before that that local port is no longer available to others. You have to explicitly close your socket, to free the local port up NOW, RIGHT NOW.
Update: Although from pure programming view, Reuse would work, but it is obviously not a good practice, and that's not the purpose of Reuse. You should always close your socket before exit. Don't program in a quick and dirty way, always do it in the right way with the best style.
| [reply] |
| [reply] [d/l] |