Online Java Compiler By
JavaTpoint.com
import java.io.IOException; import java.net.*; public class JavaSocketSetSendBufferSizeExample2 { public static void main(String[] args) throws IOException { //calling the constructor of the socket class Socket socket = new Socket(); //setSendBufferSize() sets the send buffer size or SO_SNDBUF option with the specified value //the buffer size should be greater than zero, else it will throw an exception. socket.setSendBufferSize(-67); //getSendBufferSize() method returns the buffer size(SO_SNDBUF) used by the platform for output System.out.println("Send Buffer size: "+socket.getSendBufferSize()); } }
Output