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

In reply to Re: Knowing an IO::Socket handle has by Everlasting God
in thread Knowing an IO::Socket handle has reached end-of-file by dash2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.