in reply to Re: Re: An introduction to POE
in thread An introduction to POE
- I'm QUITE sure that using \012\015 is a bad idea ... \n\r has a chance of doing the right thing.
Um, I don't think so - Read the perlport man page under the heading "Newlines". To quote:
-
A common misconception in socket programming is that "\n" eq "\012" everywhere. When using protocols such as common Internet protocols, "\012" and "\015" are called for specifically, and the values of the logical "\n" and "\r" (carriage return) are not reliable.
- print SOCKET "Hi there, client!\r\n"; # WRONG print SOCKET "Hi there, client!\015\012"; # RIGHT
This is equally applicable to the use of the literal \r and \n in general programming.
perl -le 'print+unpack"N",pack"B32","00000000000000000000001001111000"'
|
---|
Replies are listed 'Best First'. | |
---|---|
\r\n vs \012\015, was Re(3) An introduction to POE
by RMGir (Prior) on Aug 10, 2003 at 13:48 UTC | |
by tye (Sage) on Aug 11, 2003 at 07:14 UTC | |
by Anonymous Monk on Jan 13, 2010 at 05:32 UTC | |
by ikegami (Patriarch) on Jan 13, 2010 at 06:54 UTC |
In Section
Tutorials