I figured it out more or less, did it this way, I don't know how correctly, but it works as I need it!
This is only TCP, I think it will be easier with UDP, in my device, reception is over TCP, transmission is over UDP,
evaluate the code, point out the errors, and another question, can I make a...