Dear Monks

It's my understanding that the 'readers': <> and read() are filtered through the C stdio library, and that stdio automatically does:

It's also my understanding that IO::Socket::INET sockets are created with autoflush turned on, which eliminates buffering on those sockets. But what about newline conversions? As far as I can tell, newline conversions aren't affected by autoflush(). So it seems to me that if you want to prevent newline conversions while reading from a socket, you have to either:

However, on p. 119 of "Network Programming with Perl", after the author points out that when reading the message body of an http response, you must be prepared to read binary data, e.g. an mp3 file (where you don't want to do newline conversions), the author uses the following code to read the body of an http response:

print $data while read($socket, $data, 1024) > 0;

where $socket is an IO::Socket::INET socket. Isn't the read() there going to do newline conversions?


In reply to IO::Socket::INET newline conversions and buffering by 7stud

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.