G
G
geebv2016-11-12 18:38:22
Arduino
geebv, 2016-11-12 18:38:22

What is the best way to send statistical data? Through socket or UDP packets?

Transmitted via GSM module. The device is not planned to move - it will stand still. It is planned to be transmitted once every 5 seconds 1kb no more. It is critical that the periodicity be preserved.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-11-12
@Rou1997

UDP is also a "socket", you choose between TCP and UDP, TCP is better, but the periodicity, as well as the delivery of packets intact in case of network problems (disconnection after the start of sending or too low speed), it does not guarantee, you must implement this yourself, so that there is a check-sum and it is checked, in case of problems, the receiving side re-requested the packet (and the "re-request" packet also with a check-sum, and so on ad infinitum until the whole packet arrives), take care of the buffer sizes if it is different, then implement the boundaries, for example, by sending in the first bytes of the packet of its size in bytes, authorization is still required, since at any moment some bot can connect to the server and ruin everything by trying to send an HTTP request, for example.

S
Sergey, 2016-11-12
@begemot_sun

No one can guarantee you periodicity, because:
1. In the case of using UDP, the packet can simply get lost along the way.
2. In the case of using TCP, if the packet is lost, then the TCP stack will detect it and ask to send it again, another question is that it can detect it not after 5 or 10 seconds, but much later. That. periodicity will be violated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question