(port, num)
处理服务情况，num 为流编号（第 0 号还是第 1 号）
处理服务情况，num 为流编号（第 0 号还是第 1 号）
处理服务情况，num 为流编号（第 0 号还是第 1 号）
def _server(port, num):
    """
    处理服务情况，num 为流编号（第 0 号还是第 1 号）
    """
    srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    srv.bind(('0.0.0.0', port))
    srv.listen(1)
    while True:
        conn, addr = srv.accept()
        print('connected from: %s' % str(addr))
        streams[num] = conn  # 放入本端流对象
        s2 = _get_another_stream(num)  # 获取另一端流对象
        _xstream(num, conn, s2)
def _server ( port , num ) : srv = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) srv . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 ) srv . bind ( ( '0.0.0.0' , port ) ) srv . listen ( 1 ) while True : conn , addr = srv . accept ( ) print ( 'connected from: %s' % str ( addr ) ) streams [ num ] = conn # 放入本端流对象 s2 = _get_another_stream ( num ) # 获取另一端流对象 _xstream ( num , conn , s2 )