Network Roaming Ralph (panda3d example modification)

Hello, I am very new in panda3d & python, I was testing networking and I edited Roaming Ralph example (Collition detection example) to make a client/server test, the idea is to run client.py in one computer, and server.py in another one, in client computer you can move ralph around, it will send X,Y,Z coords to the server and will move ralph into it the same way you moved in the client.

Problem is: The packet string is into the function when ralph moves it sends the coords of ralph to the server, and it sends the packets TOO FAST, making it crash. I added a temporal solution that is adding a .sleep on it (just to test if the script crash was caused because the quantity of packets send to the server [it was!], of course, I have to change it, see how I can send the packets with a timer, thing I cant do yet.

Help me out, here the links test the client.py and server.py.
(you can test it in 1 computer)
filefactory.com/?ce6a2a

You want to send the position coordinates in a task that runs every so often, instead of one that runs every frame. There are several ways to do this. One simple way is to check the time in the start of your task method, and not send the information unless a certain amount of time has elapsed since the last time you sent it.

Another, more efficient (but slightly more complicated) way to do this is to use taskMgr.doMethodLater() to spawn your task function, instead of taskMgr.add(), something like this:

def myTaskFunction(task):
    doSendData()
    task.delayTime = 0.2
    return Task.again

David

I have no clue where to apply that in the code ^^