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 ) );
~~~
order of setsockopt() ???
Hi
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?
regards
glen english
sample code and order at
https://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialTCPClientandServer.html
and extract of TCPServert *FreeRTOSCreateTCPServer( from FreeRTOSTCPserver.c
~~~
xSocket = FreeRTOSsocket( FREERTOSAFINET, FREERTOSSOCKSTREAM, FREERTOSIPPROTOTCP );
FreeRTOSprintf( ( “TCP socket on port %dn”, ( int )xPortNumber ) );
order of setsockopt() ???
Are you talking about the FREERTOSSORCVTIMEO and FREERTOSSOSNDTIMEO
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
sizes, etc.
order of setsockopt() ???
Hi Richard
OK, thanks for the reply.
cheers
order of setsockopt() ???
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
bind()
.
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.
Cheers,