The serversocket class constructor has four reloads. Their definitions are as follows:
Public serversocket () throws ioexceptionPublic serversocket (INT port) throws ioexceptionPublic serversocket (INT port, int backlog) throws ioexceptionPublic
The serversocket class constructor has four reloads. Their definitions are as follows:
public ServerSocket() throws IOExceptionpublic ServerSocket(int port) throws IOExceptionpublic ServerSocket(int port, int backlog) throws IOExceptionpublic
The ServerSocket class constructor has four reloads. Their definitions are as follows:
Public ServerSocket () throws IOExceptionPublic ServerSocket (int port) throws IOExceptionPublic ServerSocket (int port, int backlog) throws IOExceptionPublic
To create a server-side using ServerSocket:The ability to accept other communication entity connection requests in Java is the Serversocket,serversocket object used to listen for the socket connection from the client.If there is no connection, it
Detailed explanation of java serversocket parameters and ocket Parameters
ServerSocket has the following three options.
SO_TIMEOUT: the timeout time for waiting for the client to connect.SO_REUSEADDR: Indicates whether to allow reuse of the address
ServerSocket has the following 3 options.So_timeout: Represents the time-out period waiting for a client connection.SO_REUSEADDR: Indicates whether to allow reuse of addresses that are bound by the server.SO_RCVBUF: Represents the size of the buffer
For real-time class applications or instant-class games, HTTP protocols are often not satisfied with our needs. This will, the socket is very useful for us. Here are the notes for this study. The main types of abnormal type, interaction principle,
The maximum queue length of the input connection indication (for connection requests) is set to the backlog parameter. If the queue is full, the connection is rejected.Note:1. The backlog parameter must be a positive value greater than 0. If the
One, SocketOptions for sockets1) Tcp_nodelay: The default value is False. Represents the use of the Negale algorithm. When set to True, indicates that the socket buffer is closed and the data is sent immediately.The socket sends the data by default
Question:
Java.net. ServerSocket. accept () will listen to the specified port for some requests and create a socket.
But some question bewilder me.
There is a code:
ServerSocket serverSocket = new ServerSocket(listenPort); // Create a server
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.