Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Server limit

 
Daniel Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,
I am writing a Java Server application using ServerSocket and when a client is sending the app data that is greater then 512 characters the message received is missing the first 512 characters and displays the rest of the message. The only thing that this app does is print to the screen what was received by the client. Any help would be great on how do I fix this problem to display the entire message sent by the client.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

Could you post a short bit of code around sending and receiving data? I'm curious about what kinds of streams you set up and how you chunk your sends. I dimly recall there are some limits around some of the streams. Maybe seeing your code will trigger some answers.

Since you're on post #1 and haven't submitted code before, I'll point out the CODE button below the editor. It puts open & close tags into the editor. When you put your code inside these, it preserves your indentation.

Cheers!
 
Daniel Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply. The code for the server and client is listed below.

<- Server code ->


<- Client code to send ->


Thanks for your help. Hopefully I did this correctly. If not please let me know.

Thanks,
Dan
 
Yuan Ye
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code looks fine to me, what os are you using on Client and Server? You might want to check your os setting for console input.
 
Daniel Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
The OS that this is running on is HP-UX B.11.23 U 9000/800. When I perform a getReceiveBufferSize() it shows me ~32K. When I set the buffer size to ~60K, I still have the problem that I currently have. I am at a loss with this one. I do thank everyone for thier help.

Thanks,
Dan
 
Daniel Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everyone, I am still having this issue. I was told that the System.in has a bug. The bug is that it only allows 512 characters at a time. Is this correct? If so, how can I get around this. Please, any help would be wonderful. I am stuck.

Thanks
 
Daniel Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just run the code on my Linux box and it ran fine. I am going to try and run the code on the SUN box I have at work. It seems that the code will not run correctly on the HP box. Any thoughts?
 
Eddie Vanda
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the "flush ()" method after sending 511 characters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic