Sending binary data over http

前端 未结 3 1208
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 08:51

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 m

3条回答
  •  清歌不尽
    2021-01-31 09:29

    If possible, you could just send the data as HTTP requests and responses.

    HTTP is perfectly capable of handling binary data: images are sent over HTTP all the time, and they're binary. People upload and download files of arbitrary data types all the time with no problem.

    Just give it a mime type of "application/octet-stream" -- which is basically a generic mime type for binary data with no further specification of just what sort -- and any proxies along the way should leave it alone.

提交回复
热议问题