when i try to create af socket with the import socket module like:
from socket import *
from thread import *
responseok = bytes('ok')
HOST = ''
PORT = 4445
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.bind((HOST, PORT))
c.listen(10)
def clientthread(conn):
dat = conn.recv(1024)
data = str(dat)
print data
conn.close()
while 1:
conn, addr = c.accept()
start_new_thread(clientthread ,(conn,))
c.close()
i get the following error:
Traceback (most recent call last):
File "C:\Users\MikeClaudi\My Documents\LiClipse Workspace\server2\src\socket.py", line 6, in <module>
from socket import *
File "C:\Users\MikeClaudi\My Documents\LiClipse Workspace\server2\src\socket.py", line 11, in <module>
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
NameError: name 'socket' is not defined