I am looking for suggestions on the best way to send/receive data from a remote GPRS device, over port 80.
Creating a plain TCP socket on a random port works fine, but many carriers only allow port 80 HTTP traffic through their proxies, and then expect HTTP ascii data (for which they can modify headers as needed.
So, should my device create a POST request on a persistent http connection, and then receive a base64 encoded response from the web service? I am not sure how mobile proxies behave when binary data is involved. Is there a recommended way to do this?
I can adapt both device's firmware and the server side app.
[Edit]
I would like to know if there is a standard (more or less) way to do this. For various data logging and industrial systems, there is a need to send lots of binary data over a socket connections. For Ethernet connections, there are usually only problems involved with adapting some firewalls, but persistent binary connections have no trouble being established over arbitrary ports.
Mobile ISPs, however, tend to limit their "data plans" for port 80 only. They also take the liberty to mess with HTTP headers, and potentially the HTML data itself. This is where I need to identify potential pitfalls and ways to circumvent them.
- Will simply sending base64 encoded data work?
- How are the HTTP sessions handled? Arbitrary sockets can be kept alive for a long time, but HTTP verbs are usually short lived. Does this mean I will need to create a new connection for each packet of data? Or is there a way to send server responses in chunks, over a single connection?
- In what ways can an ISP proxy mess with the data, or the headers? For example, a proxy can sometimes keep a connection alive, even if the server closes it.