我不断收到需要序列的 1 - 3 个参数的错误
import socket # Import socket module
import sys
import select
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Create a socket object
host = "127.0.0.1" # Get local machine name
port = 50001 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
a = []
b = []
s.listen(1) # Now wait for client connection.
c, addr = s.accept() # Establish connection with client.
s.setblocking(0)
ready = select.select(s, s, s, 1) # i believe the error lies in here
while True:
print "reached"
if ready[0]:
print "reached1"
data = mysocket.recv(4096)
print 'Got connection from', addr
c.send('Thank you for connecting \r\n') #all strings have to end with /r/n!!!
print "sent"
c.close() # Close the connection
错误
Select.select 参数 1 - 3 必须是序列。
我是 python 新手,因此我不确定错误是什么。我在另一篇文章中搜索了选择代码,因为我希望我的 recv 套接字是非阻塞的