Jump to content

  • Log In with Google      Sign In   
  • Create Account


[java] Java Sockets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 29 February 2000 - 09:55 AM

Does anyone know what happens if you send more than the client''s (or downstream) buffer can handle? In my poorly constructed program both apps stall indefinitely. JoeG

Sponsor:

#2 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 29 February 2000 - 10:30 AM

Also, how can I tell what the size of the send/recieve buffers are in JDK 1.1 ?

#3 Jim_Ross   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 February 2000 - 12:03 PM

Did you try setting the initial size of the buffer?
BufferedInputStream(InputStream in, int size);
I think the program would crash if you sent more data than the buffer could handle, because the buffer tries to accomodate by resizing it''s internal array. The only way I can think of to flood it would be to send more data than the client has in RAM. Then your program would most likely die with an OutofMemory runtime error.

#4 joeG   Members   -  Reputation: 172

Like
Likes
Like

Posted 29 February 2000 - 05:14 PM

Well I almost asked the question "How do you set the size of the socket send/receive buffers" but decided to look at my JDK docs first (the docs that go with 1.2, I''m working with 1.1) and I found the functions to do that. Pleasantly surprised, I set to work on using those functions. Needless to say, I was dissapointed to find out that JDK 1.1 didn''t support Socket::setReceiveBufferSize(int)/Socket::setSendBufferSize(int) (first clue was the red syntax error the JBuilder was giving me immediately after I typed it in ). I''m thinking that the stream i/o functions wouldn''t help because Sun added the Socket::Send/Receive]BufferSize(int) to JDK 1.2, when that would''ve been duplicating the functionality of InputStream::setBufferSize().
Now, I didn''t crash my computer (I could even CTRL+C out of the apps), but all feedback I had set up wasn''t being sent to either of the DOS windows (client one and server one). I have experimented and found that sending around 10 KB at one time will work. Sending a MB won''t. So, I guess that these Sockets prefer sending chunks of data under a certain limit (whatever that is in JDK 1.1). But I would like to know for certain....




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS