Trouble with 4 byte integer value
I'm trying to write a client server program in which each request/response message from the client to the server and back will contain the length of the message. I've heard that the best way to do this is to convert the int containing the length of the message to ASCII (making it platform independent), get the length on the server side, and then convert the ASCII back to an int.
The thing about this assignment that confuses me is that it says "all request and response messages will be preceeded by a 4 byte integer value written in network byte order to determine the length of the subsequent message. The rest of the message will be ASCII". So in trying to keep with reading 4 bytes, i'm getting the length of the message and then trying to convert the length into a 4 byte integer so that when i read it on the server side i can use an InputStream and do something like in.read(b) where b = byte.
Is there a way to do this? Did that make sense at all? Sorry if it didn't... I'm a bit confused myself.
Thanks for any input