Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Best technique to code/decode binary data for inter-machine communication?

by SuicideJunkie (Priest)
on Aug 15, 2012 at 22:41 UTC ( #987646=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Best technique to code/decode binary data for inter-machine communication?
in thread Best technique to code/decode binary data for inter-machine communication?

Were you using \n as a record separator in your protocol by any chance? Binmode would prevent conversions in transmission, but the clients would be parsing the input differently, and some would never see a "\n" since they're really looking for "\r\n".


Comment on Re^3: Best technique to code/decode binary data for inter-machine communication?
Re^4: Best technique to code/decode binary data for inter-machine communication? (newlines)
by tye (Cardinal) on Aug 16, 2012 at 01:14 UTC
    some would never see a "\n" since they're really looking for "\r\n"

    No, lack or presence of a "\r" is not going to mess up line-oriented I/O on any version of Perl1. Perl on Windows has no problem reading files that lack "\r" characters. Perl on Unix has no problem reading files that contain "\r" characters (it just includes the "\r" in the returned string).

    But a common mistake with using sockets with Perl is using <$sock>, which will hang forever until a newline or end-of-file arrives. (Using print on a socket shouldn't to be a problem as sockets shouldn't default to buffered mode.)

    1 Now that ancient Mac Perl's mistake of psuedo ASCII is history. But avoiding binmode wouldn't help in that case anyway.

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987646]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-08-23 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (174 votes), past polls