D
David Gavini
Hello,
I have a problem with my java Socket object. I hope someone can point
me in the right direction. My problem:
I have a standard java Socket (TCP) connected to a remote host and
port on a private network serving a a client process. Unfortunately I
do not have access to the server code (held by a 3rd party), however
my client process requests various services from the server. On one
particular request I perform 3 reads:
myRead(int size) {
byte[] data = new byte[size];
InputStream input = this.socket.getInputStream();
input.read(data);
}
sock.read(102);
sock.read(14);
sock.read(3008);
However my 3rd read only ever captures 1333 bytes (i.e. stops after
reading 1449 bytes). Note that I set the receiveBufferSize to 100Kb.
The server has no issues, since other companie's client process can
read the data fully, so I assume the problem is on my side.
I have tried the following code:
//DataInputStream di = new DataInputStream(input);
//di.readFully(data);
But this is even worse, it doesn't read any data at all! I have tried
creating my own server process to test with using ServerSockets and
the test proved fine, reading all the data that was sent.
I was wondering if there are any limitations on java sockets and read
methods?
Has anyone else seen the problem?
What happens when the socket buffer is full? Do the packets get
dropped or is data overwritten?
Many thanks in advance for your help!
Regards,
David Gavini
I have a problem with my java Socket object. I hope someone can point
me in the right direction. My problem:
I have a standard java Socket (TCP) connected to a remote host and
port on a private network serving a a client process. Unfortunately I
do not have access to the server code (held by a 3rd party), however
my client process requests various services from the server. On one
particular request I perform 3 reads:
myRead(int size) {
byte[] data = new byte[size];
InputStream input = this.socket.getInputStream();
input.read(data);
}
sock.read(102);
sock.read(14);
sock.read(3008);
However my 3rd read only ever captures 1333 bytes (i.e. stops after
reading 1449 bytes). Note that I set the receiveBufferSize to 100Kb.
The server has no issues, since other companie's client process can
read the data fully, so I assume the problem is on my side.
I have tried the following code:
//DataInputStream di = new DataInputStream(input);
//di.readFully(data);
But this is even worse, it doesn't read any data at all! I have tried
creating my own server process to test with using ServerSockets and
the test proved fine, reading all the data that was sent.
I was wondering if there are any limitations on java sockets and read
methods?
Has anyone else seen the problem?
What happens when the socket buffer is full? Do the packets get
dropped or is data overwritten?
Many thanks in advance for your help!
Regards,
David Gavini