Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Nov 20, 1998

Socket Buffer Size

Question:
How do I set the socket input and output buffer sizes in Java?

Answer:
You cannot set the socket input and output buffer sizes in Java versions prior to 1.2. To do so requires writing native code. You just have to live with whatever the system default values are. Starting with Java 1.2, java.net.Socket has acquired four new methods:

  • void setSendBufferSize(int size)
  • int getSendBufferSize()
  • void setReceiveBufferSize(int size)
  • int getReceiveBufferSize()
You can now use these to set and fetch the socket send and receive buffer sizes. When setting the buffer sizes, it helps to remember that the value is only a hint to the underlying system TCP/IP code as to what size should be allocated. The underlying system will not necessarily allocate exactly what you request.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date