Thank you for making my point. If you click on your own link, you will see the below.
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.
The link gives examples:
print SOCKET "Hi there, client!\r\n"; # WRONG
print SOCKET "Hi there, client!\015\012"; # RIGHT <- also wrong!
The \r is wrong. I think that:
print SOCKET "Hi there, client!\n"; #WORKS, on Unix or Windows!!
#sends CR/LF: \015\012
Basically do not ever put \r (CR) in a print statement. I agree.
For the \n in the source code, Perl will send either LF or CRLF depending upon what it is taking to.
|