petethered has asked for the wisdom of the Perl Monks concerning the following question:
I can follow what the Javacode is doing.if(more) { byte b = 64; out.write(b); out.flush(); more = false; } int size = in.readInt(); imgData = new byte[size]; for(int i = 0; i < size; i++) imgData[i] = in.readByte();
It sends a byte to the server, then reads in an int ( Since it's using readInt, im assuming the int gets passed back in plain text with a newline to end it ) then creates an array of bytes based on the size that was passed to it and then reads the bytes till the size is reached.
My problem: I don't know how to do this in perl. All of my experience with sockets is in plaintext ( mostly for webcommunication ) . Any chance of someone providing me a idea on how to do this?
PeteTheRed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading Binary Data via socket ( Converting program from java to perl )
by BrowserUk (Patriarch) on Oct 19, 2004 at 02:22 UTC | |
|
Re: Reading Binary Data via socket ( Converting program from java to perl )
by BUU (Prior) on Oct 19, 2004 at 00:49 UTC | |
by petethered (Pilgrim) on Oct 19, 2004 at 01:40 UTC | |
|
Re: Reading Binary Data via socket ( Converting program from java to perl )
by pg (Canon) on Oct 19, 2004 at 02:12 UTC |