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 ?
Can you show us some of your source code, especially the side that is receiving the string?
I suspect you might have an error like the issue described here: Read Doesn't Do What You Think It Does.
Darryl Burke wrote:
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...