Are you forking to handle the connection? Is it possible that you have the socket opened twice (once in the parent and once in the child)? That would explain why closing the child socket doesn't close the connection.
For an example of how to write a forking TCP server, have a look at the documentation for Net::TCP::Server.
| [reply] |
Lacking some snipped, I just guess.... After accepting a new connection, your program owns two sockets (and handles to those). One socket still listening for new connections and another one that represents the newly established connection (your telnet session). Maybe you just closed the listening socket instead of that of the new connection by confusing the handles? | [reply] |
That's a good call, the problem was I wasn't closing the filehandle created by accept. Thanks guys.
| [reply] |
You are going to have to provide more information in order to properly diagnose the problem. You say "I'm using IO::Socket::INET to listen for incoming data, and I want to be able to close this port within my script." You do know that this socket cannot be used to initiate a connection. This socket is designed to take inbound requests from other applications. I think you need to provide a code snippet that better typifies your action. | [reply] |