Large data IPC with the GameEngine.

Is there a limit to how much data can sent with socket.send(whatever)? I have a few megs of data being generated by an application and I’m trying to use sockets for IPC to deliver the information, but only the first segment is coming through. The amount that gets sent is inconsistent and usually in the range of 16k to 64k. The data itself is a pygame surface that I use pygame.image.tostring on and send over the socket to be read by the ImageBuff class in the VideoTexture module. Does anyone know why a socket would crap out after sending only a few k?

It maybe that the data is being sent, but your code is missing the events. In the past, I have written socket code and what I ended up doing was spending as little CPU time as possible in the data recieve event. Simply collect the data and store in a variable then exit Then on your send complete event put all the data together. I also used flags to detect if I was already executing the event. When you enter a data_receieve event, set a flag called “im_busy=true”. Then check for the flag as you enter the event as well. This can help you detect if you are simply “missing an event”.

Pseudo Code:


if im_busy !=True:
    im_busy = True
    #Do Code
    im_busy = False
else:
    print "Missed Event"

I don’t think it’s missing events, as it’s really just querying a server for a frame, and everything halts till the transmission is done.

Anyway, I’ve switched to a Pyro based IPC and it seems to work quite well. Though python spikes to 99.95% if I leave the refresh script on Always with pulse turned on. I’ve found using the delay sensor with 20 frame intervals brings the load down, but results in annoying stuttering.