When I connect as a client, the forked process starts logging the status of the client socket. The problem is that when I disconnect the client, the state of the client socket is not changed and the forked process never stops. The logfile contains the following lines:if ($self->Bind()) { while ($self->ClientSocket($self->Accept())) { $self->ClientSocket->autoflush(1); my $pid; if (!defined($pid = fork())) { $self->LogError("Fork failed: ".$!); } # Child process elsif ($pid == 0) { while ($self->ClientSocket->connected) { $self->LogComment("[".$self->ClientSocket->opened."][" +.defined($self->ClientSocket->connected)."][".defined($self->ClientSo +cket)."]"); sleep(5); } # Close the socket connection when the client goes away close($self->ClientSocket); exit 0; } # Parent process else { # Close the socket with the client close($self->ClientSocket); } } }
How do I check in the forked process that the client socket is no longer valid? And why are the opened/connected calls returning true when the client already disconnected?[1][1][1] [1][1][1] [1][1][1] [1][1][1] etc...
In reply to Socket problem by Marcello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |