FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

I am using the FreeRTOS+TCP IP stack on my STM32F429 based board. I have both a HTTP and Telnet server (which feeds FreeRTOS+CLI) running, and am able to access both of them from a PC via ethernet. I also have a client task running, that properly opens a socket to a listening server on my PC. What I cannot seem to get working is having the client task connect to either of the servers running on the same device. I have tried using both 127.0.0.1 and the device’s own IP (10.200.100.10 in this case). FreeRTOSconnect() returns -pdFREERTOSERRNO_ETIMEDOUT in both cases. For the networkIF driver, I am using the STM32Fxx/NetworkInterface.c driver supplied with FreeRTOS+TCP. Am I missing something simple here?

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

Is there a loopback interface?

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

I guess not. Forgive my ignorance, but would that require a separate network interface? I had assumed loopback was handled in the stack. This same project was working this far with LWIP, in which I believe I didn’t have a separate interface driver for loopback. However the lack of thread saftey in LWIP made for problems further down the line.

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

The easiest way to do this would be to update the driver to return packets going to its own IP address back to itself. For example, in the driver there is a send function that writes data onto the wire, and a receive function that posts received packets on a queue for processing the by the IP task. You can update the send driver to check the destination – if the destination is not itself the packet can be written onto the wire like normal, if the destination is itself the packet can be sent on the queue to be processed by the IP task just as if it had been received from the network.

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

There is no loopback interface yet in the FreeRTOS+TCP IP stack. Formally it is a different interface with its own netmask and routing rules. Yes it should be added. There is a new version of FreeRTOS+TCP available for testing: it allows to use multiple interfaces and it recognises IPv6. We will add the loopback interface to it (has not been done yet).

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

I’m just returning to this issue now again. How do I access the versions of FreeRTOS+TCP which are available for testing?

FreeRTOS+TCP sockets will not connect to localhost, does connect to remote hosts.

Would you mind to drop an email to h dot tibosch [at] freertos dot org ? The thing is, we don’t just publish software that hasn’t been fully been tested. Also, the documentation is not yet complete. Regards, Hein