hola muchahos tengo un problema con mi siguiente codigo
import socket
host = "127.0.0.1"
port = 5000
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "Socket Created"
#porque debo poner dos parentesis
sock.bind((host, port))
print "socket bind complete"
sock.listen(1)
print "socket now listening"
while 1:
#porque hay dos variables con y addr
#wait to accept a connection - blocking call
conn, addr = sock.accept()
print 'Connected with ' + addr[0] + ':' + str(addr[1])
#porque hay dos arrays distintos y una subcadena
sock.close()
mensaje de error
Traceback (most recent call last):
File "C:\Documents and Settings\antony\Desktop\test\ServerTcp.py", line 8, in <module>
sock.bind((host, port))
File "C:\Python27\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10048]