Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


FreeRTOS+TCP How to send a TCP Reset - SAM4E

Posted by bodone on June 7, 2016

Hi guys,

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.

Best regards,

Alexandre Beaudonnet

FreeRTOS+TCP How to send a TCP Reset - SAM4E

Posted by heinbali01 on June 10, 2016

Hi Alexandre,

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? Does 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


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner