I'm currently working with FreeRTOS+TCP from FreeRTOSLabs160112 on a SAM4E Xplained Pro Evaluation Kit (microcontroller : ATSAM4E16E), jointly with FreeRTOS V8.2.3, working with Atmel Studio 7.
My board is communicating with another "non-FreeRTOS running" board, through MODBUS/TCP protocol. My board is configured in client mode, and attempt to connect with the other one who is listening for entering connection requests. The connection and communication work fine but when we lost this connection for any reason, the other board don't see it and I have to reboot it, or forging a reset to make it listen again to my connection requests. I can't find out how I can send a TCP frame (with the RST flag on) through the freeRTOS+TCP API and is not experienced enough to find an other way...
I would be very grateful if someone have an idea about how to perform this reset, thank you very much for your concern.
Sorry to leave your post unanswered for so long.
when we lost this connection for any reason, the other board don't see it and I have to reboot it
That sounds a bit contradictional: the SAM4E, a TCP client, looses a connection and the server is not aware of it?
Or have you rebooted the client without shutting down the connection, maybe?
How do you notice that you loose the connection in the first instance?
FreeRTSO_recv() return an error, what is the error number?
There is no method of just sending a RST flag, except by closing the socket (
FreeRTOS_closesocket). But if the peer is just keeping silent, he will never see a RST flag.
As long as the connection is still alive, and you want to force a disconnection, you can call
FreeRTOS_shutdown(). After calling it, keep on calling
FreeRTOS_recv(), until it returns an error.
If the connection gets lost because your client has rebooted, and the server doesn't allow you to make a connection, I'm afraid you'll have to look at the software running on the server. Did you write that also? What OS is it using?
Please give more info
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.