Problems Returning an HTTP 200 Ok Message

Joshua Kugler jkugler at bigfoot.com
Thu Jul 10 15:01:51 EDT 2008


Guy Davidson wrote:

> Hi Folks,
> 
> I'm having some issues with an small socket based server I'm writing,
> and I was hoping I could get some help.
> 
> My code (attached below) us supposed to read an HTTP Post message
> coming from a power meter, parse it, and return a proper HTTP 200 Ok
> message. The problem is that the socket fails to send the entire
> message as one message, creating a fragmented message which the power
> meter then fails to read and accept.
> 
> Is there any way to force the socket to send the entire message at
> once? Am I doing anything wrong? Is there an easier way to implement
> this functionality?

I don't have a solution to the problem presented, per se, but you might have
an easier time implementing this if you use SimpleHTTPServer or
CGIHTTPServer modules.  This will take care of all the socket listening,
and a lot of other low-level details.

Hope that helps!

j




More information about the Python-list mailing list