摘要: ServerSocket类的构造方法有四种重载形式,它们的定义如下:
public ServerSocket() throws IOException
public ServerSocket(int port) throws IOException
public ServerSocket(int port, int backlog) throws IOException
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException
在上面的构造方法中涉及到了三个参数:port、backlog和bindAddr。其中port是ServerSocket对象要绑定的端口,backlog是请求队列的长度,bindAddr是ServerSocket对象要绑定的IP地址。
阅读全文