Arduino sending data to a TCP server

Hello, please help, I was climbing on the Internet but I could not find a clear answer, Google is trying hard to push me to send data with GET requests.

The bottom line: the arduino must send data to the server via GPRS. I have already figured out how to connect to a computer and send it bytes.

Question: How to catch them on the computer, so that you can then transfer them to the SQL database? In principle, DO NOT send GET or POST data. What subtleties should be followed in this case take into account(confirmation of acceptance? the checksum of the data? checking the integrity of the data? There will be several such arduinok, the data is about once in 30s, will the computer be able to receive them at the same time, or if the transmission is active with one arduino, the second will choke, how to avoid this?

Author: Сергей, 2018-08-22

2 answers

On the server side, you need to catch the server program, offhand for the implementation of the non-HTTP protocol, I can offer the following options for consideration from what is simpler-faster.

  1. Tornado (Python)
  2. Net::Server (Perl)
  3. Service for inetd-it is written on anything and works with stdin/stdout; inetd will start itself, bind the socket itself, and clean it correctly on completion.

Regarding data integrity checks and checksums -in general, TCP solves these issues, but since you have a microcontroller on one side, then the implementation of TCP may be somewhat original :)

Provide for authorization of clients on the server and (especially in the case of working through inetd) connection termination by timeout, since inetd starts a new server process for each incoming connection, which, with a large number of unclosed connections, can lead to exhaustion of the memory of the server computer.

Well, and all that: check it out the length of the rows read from the client; do minimal control of the received data, so that if the authorization data leaks, at least you do not get SQL injection; and so on. standard safety recommendations.

 0
Author: Alexander Prokoshev, 2018-08-22 22:50:16

There are such things as a SCADA system (what you have on the server and writes and displays data, for example MasterSCADA - they can take a demo for 40 points, and for the board you can take OPC server, link it all together, and in general everything is ready! With the possibility of pouring money into the project and the desire, the project can be expanded at least indefinitely. In this case, all the logic can be transferred directly to SCADA. Here is a ready-made solution to your question. So for objectivity, I will give a few more SCADA systems:

  1. simple-scada
  2. rapidscada
  3. simplight
  4. IGSS
  5. SoloScada light
  6. TRACE MODE

Choose, try and use!

 0
Author: Monomax, 2018-08-23 07:57:59