This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have been using Java Ranch for a long time. But this is my first post. Happy to interact with you all.
I am writing a client server program as a part of project. In that the client need to send parts of file (size varies from 256 bytes to 64KB ) to server.
So I used DataOutputStream and writeUTF(String s) method to send the file parts.
But the problem is server is able to get the first part and for second part it is not receiving.
I like to know is there any size constraints in string size we are sending in writeUTF() method? Can it send 64KB data to server ?
Jared Malcolm wrote:I see nothing in the documentation that points towards a limitation....
.... except this?
First, the total number of bytes needed to represent all the characters of s is calculated. If this number is larger than 65535, then a UTFDataFormatException is thrown.
Good call, I guess I didn't include this due to his max size fitting within this (figured there was probably some other issue) according to his original post. Since his max file size is at the threshold of how large he can transmit I'd probably recommend breaking it into parts first...