glenenglish wrote on Thursday, February 22, 2018:
I read the documentation on the use of setsockopt and the example has the following order- setsockopt is called AFTER the bind
However in your provided code, setsockopt is called BEFORE the bind.
Which is the intended order?
sample code and order at
and extract of TCPServer_t *FreeRTOS_CreateTCPServer( from FreeRTOS_TCP_server.c
xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
FreeRTOS_printf( ( "TCP socket on port %d\n", ( int )xPortNumber ) );
if( xSocket != FREERTOS_NO_SOCKET )
xAddress.sin_addr = FreeRTOS_GetIPAddress(); // Single NIC, currently not used
xAddress.sin_port = FreeRTOS_htons( xPortNumber );
FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );
FreeRTOS_listen( xSocket, pxConfigs[ xIndex ].xBackLog );
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, ( void * ) &xNoTimeout, sizeof( BaseType_t ) );
rtel wrote on Thursday, February 22, 2018:
Are you talking about the FREERTOS_SO_RCVTIMEO and FREERTOS_SO_SNDTIMEO
options? If so I don’t think it matters, you can change those options
whenever you want. That doesn’t hold for all options, such as window
glenenglish wrote on Friday, February 23, 2018:
OK, thanks for the reply.
heinbali01 wrote on Sunday, February 25, 2018:
For some reason, SourceForge stopped forwarding me emails. So I’m sorry if I’m apparently slow in responding.
I can not think of an socket option that is somehow related with
There are some options, that should be set before a connection is established: those options are related to buffer- and windows-sizes.
Yet other options, especially the ones setting time-outs, can be changed at any time.