First I'm interested in the code sample you gave:
Currently I write that as:$to->send( pack 'n/a*', $binData );
Is your code a shorthand for the above?$binData = pack('N',length( $data ) ) . $data; $to->send( $binData );
Second, as you and others have pointed out, I did not use 'binmode' after opening the socket. If I were to add the following:
To both the client and server code, would I be in 'binary' mode on windows, *nix, etc. or would I need to have different client code for each. Reading the latest 'binmode' documentation, it sounds like the function would be ignored on some systems and then used where binary and text definitions differ.binmode Socket, ":raw";
Third, 'Storable' does not produce 'network neutral' results, so can't be used in this case.
Fourth, if someone passes a ':utf8' key/value pair to my application and I store the variables in an external file as ":raw", will they be able to use the data as utf8 when they receive the key/value pair back. Until I read the 'binmode' documentation, I didn't think of that possibility!
Thank you
"Well done is better than well said." - Benjamin Franklin
In reply to Re^4: Best technique to code/decode binary data for inter-machine communication?
by flexvault
in thread Best technique to code/decode binary data for inter-machine communication?
by flexvault
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |