Hi

Clearly there is a right way to read a socket and a wrong way. If I
open a socket connection to a windows server to another windows server
and then read the input stream I am able to read all the data
correctly.

If I take the same code an run it on a linux server (reading the socket
on the windows server) then the code on the linux server seems to
receive less data from the windows socket.  2219 vs. 1368 bytes.

I have a sneaky suspicion that it has something to do with byte
encoding differences, but I'm not sure how to solve the problem, or
what the right way to read a remote socket is. Below is a sample of the
code used.

int x = 0;
ByteArrayOutputStream in = new ByteArrayOutputStream();
x=binput.read(b);
while (x > 0) {
        in.write(b,0,x);
        if (x==BUFFER_SIZE) {
                x=binput.read(b);
        } else {
                x = 0;
        }
}
System.out.println("Read " + in.size() + " bytes from ITC");


>>Output on windows:<<
Read 2219 bytes from ITC

>>Output on linux:<<
Read 1368 bytes from ITC

Do you guys know what the right way of doing this is?

Thanks,
Paul


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CTJUG Tech" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Tech
-~----------~----~----~----~------~----~------~--~---

Reply via email to