Network doesn't send when GE is running


I got a problem with establishing some simple networking with blender/ge: First some code:

import threading
import socketserver
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
    def handle(self):
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
    allow_reuse_address = True
if __name__ == "__main__":
    HOST, PORT = "", 5001
    server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
    ip, port = server.server_address
    server_thread = threading.Thread(target=server.serve_forever)

The problem is that sender doesn’t send data over the network in the handle-function when the game-engine is running. This whole script is started by an actuator. After pressing ESC the server thread is still running. Therefore it accepts connections and everything is working fine. The real handle-function reads and writes multiple times in a while loop. Everything works fine after shutting down the GE. But with running GE I can only read data once.
I tried the similar of the example above with UDP but it doesn’t send neither (only when GE is running).

Anyone got an idea what I’m doing wrong? Is there any trick to send data?

Edit: I use blender 2.56

many thanks,

Hi Christian! Have you heard about Old Jim’s project?

Don’t forget to check it out, it should interest you:



Hi ChicOrtiz,

thanks for the answer. Yes, I found these pages. My problem was that all these examples don’t explain the general problem that one have to use asyncronous IO and the dispatching has to be done manually. I got the tip to use asyncore for this and now it seems to work! :slight_smile: