python - i am getting error [ socket.gaierror :[Errno 11004] getaddrinfo failed] -
here code snippet: import socket,sys s = socket.socket(socket.af_inet,socket.sock_dgram) max = 65535 port = 6000 if sys.argv[1:]==['server']: s.bind(('127..0.0.1',port)) print 'listnening @ ',s.getsockname() while true: data ,address = s.recvfrom(max) s.sendto('your data %d bytes' %len(data),address) elif sys.argv[1:] == ['client']: print 'address before sending'.s.getsockname() s.sendto('this message ',('127.0.0.1',port)) print 'address after sending ',s.getsockname() data,address = s.recvfrom(max) print 'the server ',address,' says',repr(data) else: print >>sys.stderr, 'usage: udp_local.py server|client' i getting error [ socket.gaierror :[errno 11004] getaddrinfo failed] just replace line: s.bind(('127..0.0.1',port)) with this: s.bind(('127.0.0.1',port))