I have the following source code:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
s.bind(('', 9800))
try:
while True:
data, addr = s.recvfrom(256) #buffer size is 256 bytes
print data, adrr
finally:
s.close()
And when I execute it I get the following error:
Traceback (most recent call last): File "socket.py", line 1, in import socket File "C:\Users\Victor\Desktop\socket.py", line 3, in s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP AttributeError: 'module' object has no attribute 'AF_INET'
How can I solve this?