socket.gaierror: [Errno -5] No address associated with hostname

# server.py 
import socket 
import time 
# create a socket object 
serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) 
# get local machine 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))
    currentTime = time.ctime(time.time()) + "\r\n"
    clientsocket.send(currentTime.encode('ascii'))
    clientsocket.close()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81750d83-aae9-4382-bdee-8860671b6682%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to