newbi3 Posted February 2, 2013 Share Posted February 2, 2013 I am re-writting an application I wrote in java in python. The problem I am having is even though I have multi-threaded the server I can only get 1 client to connect each time the server runs. Here is the error I am getting socket.error: [Errno 104] Connection reset by peer Here is the server which gets the connection and passes it off to a new thread def startServer(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) Misc.mmrghPrint("Zombie Server Started") while 1: s.listen(5) Thread(target=ZombieThread.authenticate(s.accept()), args=(s.accept())).start() # <-- Here pass Here is the thread that it is passed off to. def authenticate(socket): conn, addr = socket zombieIP = Misc.parseAddr(addr) # Client to Server Challenge ClientSecretNum = 547623564 key = int(Misc.recvDecrypted(conn, 1024)) Misc.sendEncrypted(conn, key + ClientSecretNum) # Server to Client Challenge ServerSecretNum = 6992825753837 challengeNum = randint(1111111111111111, 9999999999999999) Misc.sendEncrypted(conn, challengeNum) respondse = int(Misc.recvDecrypted(conn, 1024)) if respondse != (challengeNum + ServerSecretNum): Misc.mmrghPrint("Could not authenticate zombie from " + zombieIP) conn.close() else: Misc.mmrghPrint("Zombie connected form " + zombieIP) conn.close() Maybe someone here can shed some light onto what my problem is and save me from bashing my head into a wall! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.