Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


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 ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists