How do I recieve byteArray send from Server and read 4 single bytes at a time.
- by k80sg
I need to receive 320 bytes of data from a server which consist of 80 4 bytes int fields. How do I receive them in bytes of 4 and display their respective int values? Thanks. Not
sure if this is right for the receiving part:
//for reading the data from the socket
BufferedInputStream bufferinput=new BufferedInputStream(NewSocket.getInputStream());
DataInputStream datainput=new DataInputStream(bufferinput);
byte[] handsize=new byte[32];
// The control will halt at the below statement till all the 32 bytes are not read from the socket.
datainput.readFully(handsize);