in reply to Knowing an IO::Socket handle has reached end-of-file
Depends on the socket type. Tcp sockets are 'connection
oriented', meaning that there is a definite begining and end
to the communication channel. These states are singnaled by
various controll packets, including a request to open a connection
(ok, so it's not quite that simple, with the sync handshaking and
whatnot, but that's not important) and one to close it, definitively
signaling the end of data, until the connection is reopened.
I don't have a clue about what the server you are connecting
to is doing, but there is the posibility that is doesn't close
the connection when it is through with a block of data, presumably
is anticipation of more data to be sent, but I think it would send
an eof or eot char. Don't quote me on that last bit though, can't remember off the
top of my head. Time to go grab the crab book...
Udp, on the other hand, is message oriented, so a listening
socket is always ready to recieve data, and if said data happend
to include a listening udp port address on the sending machine (a pretty common practice)
then a two way data flow can be established, but one can never know
if this is the last packet, short of knowing that the remote
machine is no longer up or reachable.
Sounds like you are using tcp connections, so there is a definite
and signaled end to the connection.
'The fickle fascination of and Everlasting God'
- Billy Corgan, The Smashing Pumpkins