Code example for ServerSocket

Methods: bind, setReuseAddress

0
    public NormalTcpServer(String name, String proxyHost, int proxyPort) {
        this.name = name;
        this.proxyHost = proxyHost;
        this.proxyPort = proxyPort;
        try { 
            serSocket = new ServerSocket();
            serSocket.setReuseAddress(true);
            serSocket.bind(new InetSocketAddress(servPort));
            inService = true;
        } catch (IOException e) {
            Logger.e(TAG, "Server初始化错误,端口号" + servPort, e);
        } 
        Logger.d(TAG, name + "启动于端口: " + servPort);
 
    } 
 
    public boolean isClosed() { 
        return (serSocket != null && serSocket.isClosed());
    } 
 
    public void close() {