> -----Original Message----- > From: Xavier Ambrosioni [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 19, 2003 1:26 AM > To: [EMAIL PROTECTED] > Subject: Using socket in perl > > > Hello all, > > I'm writing a server and a client in perl. My client communicates with > the server using sockets. > I'm using IO::Socket::INET to create the sockets.
I too am in the middle of writing this exact thing. > My problem is that when my client close the socket, the expressions > "while ($line = <$client>)" is an infinite loop and $line > contains "\n"; > How can I know in the server when a client close a connection ? Funny, I don't have this problem. Before this loop, a have another loop: while (!$quit) { next unless $session = $sock->accept; This is my socket session loop. Then, I have a "read data from session" loop: while (<$session>) { And, when the client closes the socket, this EOFs and the loop falls out. This sounds like a problem in your OS or the way the socket is being created. Do you have more code you can show, such as the options you use creating the socket listener or client? Did you turn buffering off in your client? Do you send extra linefeeds in your client? Is your close SOCKET statement in your client returning any errors? -Mark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]