服务器并不是主动地建立连接.相反地,他们是被动地监听一个客户端的连接请示然后给他们服务.服务器是由类ServerSocket来建立的.下面的程序建立了一个服务器端socket并把它绑定到80端口: ServerSocket serverSocket = new ServerSocket(80, 5); 第一个参数是服务器要监听的端口.
Unlock the full InfoQ experience by logging in! Stay updated with your favorite authors and topics, engage with content, and download exclusive resources. The panelists discuss the dramatic escalation ...