• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending string using writeUTF

 
Greenhorn
Posts: 6
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi all,
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 ?

Thanks

 
Ranch Hand
Posts: 54
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see nothing in the documentation that points towards a limitation....

readUTF();

writeUTF();

possibly provide some code to point towards an answer?
 
Ranch Hand
Posts: 31
MyEclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
readUTF and writeUTF are obstruction methods.
try readUTF in you server.
just like you wirte a message,the server must read it.or it will be obstructed
I hope this will help you.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

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.
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's an obstruction method?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think he means a blocking method.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote:I think he means a blocking method.

Thank you
 
Jared Malcolm
Ranch Hand
Posts: 54
MySQL Database PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic