高洛峰2017-04-18 10:45:33
websocket or json
Don’t use long connections when using 2G network, many people fall here.
I’m not sure what hardware platform you’re talking about. If it’s iOS or Android, both support curl-type methods to perform POST/GET on the web server, that is, to complete file upload and data download. Both parties use json format for data exchange; binary data packets are encoded into standard text using base64 encoding. Currently, more than 90% of Internet protocols follow this standard, including the uploading of larger files, which is very common. Very stable and reliable. Websocket is another http-based method that allows the server to send messages directly to the client. You can encyclopedia it yourself. If your "hardware platform" is neither Android nor iOS, but embedded Linux or the like, you can write it directly using curl + bash or wget + bash scripts. You may not even need to write C language programs, it is still very easy. Stablize. If your hardware is none of the above three, then you should probably change your job, because it is really not mainstream. . .
巴扎黑2017-04-18 10:45:33
I am not talking about any of the situations mentioned on the first floor. The terminal microcontroller uses socket long connection for communication. It is responsible for collecting information, uploading, downloading content and printing. The number of terminals is 5k+. The server is written in C++ and runs under centos.
What I find very funny is that apart from web applications and built-in WebView, who would use an extremely bloated protocol like http in actual products?