You're using the readline operator <> to read your socket. This operator will, of course read _lines_ of input. The default line separator is \n. Your server code will read bytes until it sees a line end, just like it would if you were reading from a file. When you printed the "\n" to the socket, the server thought that the socket reading was over, and continued on. If you want to read bytes over newlines, you'll need to do a

local $/= (anything but\n)

inside your server to make sure that the server thinks that the end of the line is what you say it is whilst it it reading from the socket...
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."


In reply to Re: Newline Character and Socket Comms by chorg
in thread Newline Character and Socket Comms by Ducati

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.