GPRS device?

Mar 11, 2013 at 1:41 AM

This sounds like exactly what I need, but have a question (or two):

The situation for me:

A GPRS printer device that makes requests of my server for orders to print. My application queries the DB for orders and returns a formatted string to the printer if an order is found. The device only accepts 1024 bytes at a time. The server is expected to return 206 (Partial response) if the order string is longer than 1024 bytes. The device resumes immediately.

Does the situation above sound like what your library supports?

Looking forward to your response.
Mar 11, 2013 at 2:04 AM
Unfortunately I don't believe this will work for you. This library accepts byte-range requests for a given stream and returns the bytes requested as a single or multi-part response. It sounds like your needs are different - you're requesting a resource but you need it chunked into 1024 byte responses, probably as a result of a limited receive buffer. You should probably pursue the HTTP spec on chunked transfers - that might be what you're looking for.

I'm actually curious to know if there are solutions out there already. I suspect you might just end up getting your response prepared, checking to see if it's more than 1024 bytes and manually setting HTTP response code, content length and writing 1024 bytes at a time to the stream, flushing and looping until complete.