得到这个错误" ConnectionAbortedError:[WinError 10053]已建立的连接已被主机中的软件中止"

时间:2017-02-21 15:46:16

标签: python python-2.7 python-3.x sockets websocket

**当我输入" dir"在控制台中我收到此错误,错误显示此行" client_response = str(conn.recv(1024)," utf-8")" **

def socket_accept():

conn, address = s.accept()
print("Connection has been established | " + "IP " + address[0] + "| Port " + str(address[1]))
send_commands(conn)
conn.close()


def send_commands(conn):

while True:
    cmd = input()
    if cmd == 'quit':
        conn.close()
        s.close()
        sys.exit()
    if len(str.encode(cmd)) > 0:
        conn.send(str.encode(cmd))
        client_response = str(conn.recv(1024), "utf-8")
        print(client_response, end ="")

1 个答案:

答案 0 :(得分:0)