Hello Experts,
I am using the TCP Socket in my Java application. I am trying to receive the byte data from some device. I am using the readInt(); method for receiving the data form the device. This method works fine if i am getting the 4 bytes from the device and if the bytes are less then 4 bytes or nothing then readInt(); hangs(blocked and not returning back the control) method. It should throw EOFException exception if no data is to receive but its hanging.
Code Sample :-
DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream()); DataInputStream din = new DataInputStream(socket.getInputStream());
int res = din.readInt();
Thanks in advance. Aj