I believe there is a mistake in the sample code on this page:
The comment indicates that the IP address of the remote socket will be 192.168.0.50, but invokes the macro below with an incorrect number of arguments (and incorrect value).
xRemoteAddress.sin_addr = FreeRTOS_inet_addr_quick( 192, 168, 0 200 );
There seems to be a missing comma after the zero and it should be “50”, not “200”.
Thanks for taking the time to point this out. The err has been corrected although the correction won’t be visible until the website is next deployed.
Thanks Richard. It’s a little unsettling that after a very cursory look at the documentation, I found an example that not only wouldn’t work - it wouldn’t even compile. What kind of vetting process did the examples go through?
The code snippets on the website are informative only - they are not part of a program that gets compiled.
The same tutorial, “Sending Data Using a TCP Socket”, has another mistake (“char char” below):
void vTCPSend( char char *pcBufferToTransmit, const size_t xTotalLengthToSend )
Got it - thanks. Again won’t be visible until the website gets deployed again.
I also noticed that there is a mismatch in the remote port number mentioned in the comment (1500) and that specified by the code (15000).
Whoever corrected the FreeRTOS_send() example placed a period after the zero in the line below, rather than a comma.
xRemoteAddress.sin_addr = FreeRTOS_inet_addr_quick( 192, 168, 0. 200 );