1. The server has 65,535 ports, which is the variable that records the server port, is two bytes and is a short int. Its two-byte storage space determines that it can only open 65535 ports.
2. What is the port for? The port is used to listen for TCP connections. That is, the client HTTP connection is communicated using the IP address + server port number.
3. That the client comes in HTTP connection request, who will listen to the server port? Is the application, similar to the software such as Tomcat.
4. The serversocket of the application has the bind () method, which binds to the specified port of the server. The ServerSocket then accepts the request from the client using the Accept () method.
This is the port that the client sends (server IP address + server port number)----> server-side Program call Code serversocket.accept () listens on the server. This allows the client to establish a connection to the server-side application.
5. Port number and TCP connection number a little relationship!!! The specific number of TCP connections, which are fully connected by serversocket.accept ().
Serversocket.accept () Each time a connection is established, the port number of the binding refers to the client's port number, so that the data is returned to the client's application.
6. The number of TCP connections that can be accommodated by a tomcat is completely related to server performance and can be tens of thousands of. Not 500, 500 refers to Tomcat to build up to 500 threads, traditional bio communication threads.
7. Today's tomcat communication can hold tens of thousands of concurrent.
Relationship between server ports and connections and applications