Online Java Compiler By
JavaTpoint.com
import java.io.IOException; import java.net.*; public class JavaSocketGetReceiveBufferSizeExample1 { public static void main(String[] args) throws IOException { //calling the constructor of the socket class Socket socket = new Socket(); //setting the buffer size with the help of setReceiveBufferSize() method socket.setReceiveBufferSize(789); //getReceiveBufferSize() method returns the buffer size set for this socket System.out.println("Buffer size: "+socket.getReceiveBufferSize()); } }
Output