摘要: ServerSocket類的構(gòu)造方法有四種重載形式,它們的定義如下:
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
在上面的構(gòu)造方法中涉及到了三個(gè)參數(shù):port、backlog和bindAddr。其中port是ServerSocket對(duì)象要綁定的端口,backlog是請(qǐng)求隊(duì)列的長(zhǎng)度,bindAddr是ServerSocket對(duì)象要綁定的IP地址。
閱讀全文