Socket setSendBufferSize Example

Socket class setSendBufferSize example. This example shows you how to use setSendBufferSize method.


Socket class setSendBufferSize example. setSendBufferSize public void setSendBufferSize(int size) throws SocketException Sets the SO_SNDBUF option to the specified value for this Socket. The SO_SNDBUF option is used by the platform's networking code as a hint for the size to set the underlying network I/O buffers.

Here is the code
/*
 * @ # SetSendBufferSize.java
 * A class repersenting use to SetSendBufferSize method 
 * of NumberFormat class in java.net package
 * version 17 June 2008
 * author Rose India 
 */

import java.net.*;

public class SetSendBufferSize {

    public static void main(String args[]) throws Exception {
        Socket socket = new Socket();

        //Connects this socket to the server.
        socket.connect(new InetSocketAddress("192.168.10.222"8080));

        System.out.println("Send Buffer Size " + socket.getSendBufferSize());
        socket.setSendBufferSize(1024);
        System.out.println("Send Buffer Size " + socket.getSendBufferSize());

        socket.close();
    }
}

Output
Send Buffer Size 25290
Send Buffer Size 1024

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US