Failed to use FreeRTOS+CLI over UDP - bind fail

Hello,
I’m trying to add CLI console to my FreeRTOS AWS IOT application.
When I 'm using my target STM32 the CLI over UART is being used and all working as expected.
I have a crossed compile Visual Studio solution version of the same project and I’m trying to use the FreeRTOs CLI here as well, but instead of using the UART I want to use a UDP terminal (Actually any option will do as long as it will be on a separate console then the IOT logs).
I tried to test the “out of the box” FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator but I get an error message when I try to run it:

Could not socket to port 5001

I have a YAT terminal open with those parameters:
image
I stopped my Firewall just in case but it did not helped.
Any idea?
Thanks,
Eyal

Is the error coming from the FreeRTOS app or Yat? If from the FreeRTOS app, can you find where the error message is printed out - you should be able to link to the line in Github.

It is coming from FreeRTOS UDPCommandServer.c line 210.
(How do you link to a line?)

Interesting, I see that is using the Windows TCP/IP stack, the socket has been created successfully, but Windows will not allow the socket to be bound. You should be able to use WSAGetLastError() to determine the cause. See https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind. You could also try with a much higher port number, say 50000.

If you click the number to the left of the line it creates a URL like this: https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/UDPCommandServer.c#L210

OK, The error I get is 10013:

WSAEACCES
10013 Permission denied.
An attempt was made to access a socket in a way forbidden by its access permissions. An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST).
Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access. Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option.

I changed the port to 8001 and now it is working as expected.

Thanks!