FTP and HTTP do not work (similar problem in both)

rasty1 wrote on Monday, July 18, 2016:

I face similar problem with FTP and HTTP.
I’m able to login with FTP, execute CD.
Commands dir, get and put hang.
I made some logging, last message that I see is from prvTransferStart - “prvTransferStart: 0xc06777f4 connected 0”
Application spins infinitely though prvListSendWork, but does not enter While loop, because pxClient->bits1.bClientConnected is false.

I assume that FTP waits for connection, but it does not happen.

I’d appreciate any hint.

heinbali01 wrote on Monday, July 18, 2016:

Hi Rasty,

You send me this FTP conversation:

    220 Welcome to the FreeRTOS+TCP FTP server
    331 Anonymous login okay
    230 OK.  Current directory is /
    CWD www
    250 Changed to /www
    PORT 10,4,20,24,249,127
    200 NOOP command successful.
    150 Opening ASCII mode data connection to for /bin/ls 

PORT 10,4,20,24,249,127 means : please connect to port 63871 is a different network from And so your embedded device probably doesn’t know how to connect to

Within +FTP, the address resolution is simple: if an IP-address doesn’t match with its own net-mask, then the packet will be sent to the Gateway IP address.

rasty1 wrote on Monday, July 18, 2016:

You’re right.
Explanation (bit long, sorry)
I have 2 networks

  1. lan on
  2. internal (virtual nic) on Linux Host

I run FTP client on, which talks to (linux, IP forwarding enabled).
Linux has internal IP and target is

On my PC ( I added a route to

I’m able to talk from MY pc ( to target with telnet, so I assume that FTP will be OK as well.

Maybe I have to set default gateway on FreeRTOS to ?

rasty1 wrote on Monday, July 18, 2016:

Problem was in routing. FreeRTOS does not know how to send frames outsize its own subnet
I have to set Gateway to peer address,** I’m not sure that it is correct**:

IP address
Net mask
Gateway address <<-- peer address, otherwise it does not Work

FTP “dir” and “get” Work!!!
“Send” does not work. Still hangs.
Thank you very much you are great.

Send and HTTP will be the next step

heinbali01 wrote on Monday, July 18, 2016:

I’m able to talk from MY pc ( to target
with telnet, so I assume that FTP will be OK as well.

Good you mention this.
When you use telnet, your embedded device is the TCP server, it accepts a connection.
Also when you connect to the embedded FTP-server and execute CWD www, things works well.


When the embedded device is the TCP server, it doesn’t bother looking up the return MAC address. It just swaps the two MAC addresses when replying. The driver also stores the return MAC address for later use.

For the FTP commands “LIST” and “STOR”, and “RETR”, a new connection is needed. These commands need a separate data-only connection. It can be established either passively or actively.

    PASV	// The server will receive a connection using accept()
	    227 Entering Passive Mode (192,168,2,1,45,67)

    PORT 10,4,20,24,249,127 // The server will connect() to the client

For you PASV would have worked OK. But you used an active connection ‘PORT’.

The routing thing: as I wrote, when your device connects to a strange IP address such as, it will not bother looking up the IP-address with ARP. In stead it will send all packets to the configured gateway address.

What should you use as a gateway address?
That can not be said in general. Maybe your router will do the routing. If not (when using a switch), you can use the IP-address of the adapter that is connected to that switch.

For your device, it looks like a DELL device with MAC address 5c:26:0a:48:2b:24, being the return address of the FTP client.


rasty1 wrote on Tuesday, July 19, 2016:

I found all bits and bytes, everything work Fine.
Major problem was gateway address for FreeRTOS - it shall be peer address.
Thank you very much all.