0
Socket server
As in socket it will set the address on ip, instead of on host(url)
3 Respostas
+ 1
import socket
# get name
host = socket.gethostname()
port = 9999
# bind to the port
serversocket.bind ((host, port))
# queue up to 5 requests
serversocket.listen(5)
while True: # establish a connection clientsocket,addr = serversocket.accept()
print ("Got a connection from %s" % str(addr)) msg = 'Thank you for connecting'+ "\r\n" clientsocket.send (msg.encode('ascii')) clientsocket.close()
0
i writed
socket.socket.bind(("my ip",4830))
error
Errno 99
Cannot assign requested address
0
nono. I want to use ip instead of host