import socket
host='222.135.146.245'
port=20438
addr=(host,port)
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
s.bind(addr)
print "Waiting for connections..."
s.listen(1)
while 1:
clientsock,clientaddr=s.accept()
print"Got connection from",clientsock.getpeername()
clientsock.close()
Traceback (most recent call last):
File "C:/Python27/点到系统/实验.py", line 7, in <module>
s.bind(addr)
File "C:\Python27\lib\socket.py", line 222, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10049]
------解决方案--------------------------------------------------------
C:\Python27\lib\socket.py
socket 的bind 方法是怎样的?