ServerSocket SetReceiveBufferSize() Example
Sets a default proposed value for the SO_RCVBUF option for sockets accepted from this ServerSocket.
ServerSocketclass SetReceiveBufferSize() method example. This example shows you how to use SetReceiveBufferSize() method.This method Sets a default proposed value for the SO_RCVBUF option for sockets accepted from this ServerSocket.
Here is the code:-
/**
* @Program that Sets the value of the SO_RCVBUF option for this ServerSocket
* SetReceiveBufferSize.java
* Author:-RoseIndia Team
* Date:-21-jun-2008
*/
import java.net.*;
public class SetReceiveBufferSize {
public static void main(String[] args) throws Exception {
InetAddress i = InetAddress.getByName("girish-desktop");
ServerSocket ss = new ServerSocket(8080, 1, i);
System.out.println("RCVBUF option for this ServerSocket is: " + ss.getReceiveBufferSize());
//Sets the value of the SO_RCVBUF option for this ServerSocket
ss.setReceiveBufferSize(234);
System.out.println("RCVBUF option for this ServerSocket is: " + ss.getReceiveBufferSize());
}
} |
Output of the program:-
RCVBUF option for this ServerSocket is: 43690
RCVBUF option for this ServerSocket is: 1024 |
|