我想在线程中发送即将到来的请求的socket
对象,以便我可以进一步与之通信。我是通过args=c
发送的,但它无效。
import socket
import sys
import json
import threading
class server6:
s = socket.socket()
host = socket.gethostname()
port = 123
s.bind((host,port))
s.listen(5)
while True:
c, addr = s.accept()
print("Connection accepted from " + repr(addr[1]))
print(str(c) + " :: " +str(addr))
threading.Thread(target=threadMine, args=c).start()
c.close()
def threadMine(self, socket sock):
#print("Thread"+ sock)
有人可以看一眼吗?