Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

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

Posted by rasty1 on 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. Thanks Rasty


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

Posted by heinbali01 on July 18, 2016

Hi Rasty,

You send me this FTP conversation:

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

PORT 10,4,20,24,249,127 means : please connect to 10.4.20.24 port 63871

10.4.20.24 is a different network from 192.168.2.1. And so your embedded device probably doesn't know how to connect to 10.4.20.24.

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.

Attachments

ftp.pcapng (3368 bytes)

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

Posted by rasty1 on July 18, 2016

You're right. Explanation (bit long, sorry) I have 2 networks 1) lan on 10.4.20.0 2) internal (virtual nic) 192.168.2.0 on Linux Host

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

On my PC (10.4.20.24) I added a route to 192.68.2.0

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

Maybe I have to set default gateway on FreeRTOS to 192.168.2.1 ?

Attachments

ftp.pcapng (3368 bytes)

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

Posted by rasty1 on 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-config

IP address 192.168.2.1 Net mask 255.255.255.0 Gateway address 192.168.2.2 <<-- 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

Attachments

ftp.pcapng (3368 bytes)

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

Posted by heinbali01 on July 18, 2016

I'm able to talk from MY pc (10.4.210.24) to target 192.168.2.1 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.

Why?

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 192.168.2.1 connects to a strange IP address such as 10.4.20.24, 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.

Regards.

Attachments

ftp.pcapng (3368 bytes)

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

Posted by rasty1 on 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.

Attachments

ftp.pcapng (3368 bytes)


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS