Hi All,

At the moment I have a v simple client app connecting to a socket which receives raw binary data. I have the same app effectively in C++ which works fine - so I know I'm not writing the client properly.

Basically it is receiving data, but with massive message loss. For every 10 or so messages only one gets read in to the app. Just wondered if anyone has any suggestions where this is going wrong?

Here's the code - simply looks or a DWORD (4 Bytes), then reads 253 + DWORD from the socket.

		//Receive data from SerialtoNetwork server
			while (true)
				byte[] cbuf = new byte[300];
				int lBytesAvail = in.available();//read(cbuf, 0, 4);
				if (lBytesAvail > 4)
					in.read(cbuf, 0, 4);
					int lBytesRead = in.read(cbuf, 0, 253);
					String lstr = new String(cbuf);
					System.out.println("Bytes Received:" + lBytesRead);
		catch (IOException e)
			System.out.println("Read failed");

Many Thanks