Strictly speaking, I think this is outside the gadget makeRequest() purview, but 1) I think some folks here might have relevant experience, and 2) there's a chance it's related to some issue with makeRequest() internals. Any advice is appreciated.
I'm trying to implement a simple server in python that will receive opensocial GET and POST messages sent from a gadget via makeRequest (). The python BaseHTTPServer is a simple implementation of this. Basically, the server calls socket.accept() and waits for an incoming request. When a request arrives, it calls recv() a few times to read in the request until the incoming socket stream is empty, then goes back to waiting for another request via accept() on its original socket. My problem is that I need to call recv() a few times until the stream is empty. And when the stream is empty, the recv() call hangs for about 10 seconds before returning. This happens in the C socket libraries, so it doesn't seem to be a python issue. I can find out from the GET/POST how large the incoming message is and only read exactly that many bytes off the socket.recv() call. In that case, recv() does not hang, but apparently the request is not considered to be completed either. When the server returns to waiting on accept(), it receives an extra copy of the message. I have fiddled with setting the timeout on the socket before calling recv(), but that doesn't seem to help. Does anyone have experience with this? I looked around for quite some time for answers, but found none. Socket programming is a bit arcane at this level, but I'm having trouble seeing what the issue is. Thanks, Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
