File STOR issue of W5500 FTP Server

Hey,

I’m working on a project with W5500 and the TCP and UDP are all working good.
I’m trying to start a FTP server with W5500 and it seems working. I can list all the files on the MCU side and I can retrieve the file to PC client(I’m using FileZilla and WinSCP, all working.)
Now the only issue is when I’m trying to store a file(named a.txt with content 123) back to the server, it got struck and timed out every time.
The client has received the STOR response from CONTROL SOCKET and it’s 150 Opening data channel for file upload to server of xxx. The DATA SOCKET also get its client connected. But there’s no any data received from DATA SOCKET. And the DATA SOCKET connection will disconnect right after the connect established.

I’m trying to find answer from the ioLibrary, and there’s difference on proceeding the STOR command.
The ioLibrary starts an active DATA SOCKET connection to the client in STOR command handing, see below source code,

case STOR_CMD:
slen = strlen(arg);
arg[slen - 1] = 0x00;
arg[slen - 2] = 0x00;
#if defined(_FTP_DEBUG_)
printf("STOR_CMD\r\n");
#endif
if(strlen(ftp.workingdir) == 1)
    sprintf(ftp.filename, "/%s", arg);
else
    sprintf(ftp.filename, "%s/%s", ftp.workingdir, arg);
        slen = sprintf(sendbuf, "150 Opening data channel for file upload to     server of \"%s\"\r\n", ftp.filename);

send(CTRL_SOCK, (uint8_t *)sendbuf, slen);
ftp.current_cmd = STOR_CMD;
if((ret = connect(DATA_SOCK, remote_ip.cVal, remote_port)) != SOCK_OK)    {
#if defined(_FTP_DEBUG_)
    printf("%d:Connect error\r\n", DATA_SOCK);
#endif
 return ret;
 }
connect_state_data = 0;
break;

I didn’t do this one since I’m using the PASSIVE mode. I’m not sure if I should try to modify this one to the same way of ioLibrary. But it seems there’s no remote ip and port will be sent to the server on PASSIVE mode.

It seems the interval within DATA SOCKET establish, send data and close are really short and the W5500 Data Received interrupt didn’t trig.(I’m not sure about this.)
I captured the packets below, the interval between TCP-ACK and FTP-DATA, FTP-DATA and TCP-FIN are really short(within 0.1ms).

The issue confuses me for almost a whole week. My TCP client, UDP, even CONTROL SOCKET TCP server are all working really stable, but just this STOR command issue.

Can I get help or any clue from you guys? I appreciate.

Vincent

I think it will take a long time for me to properly analyze this. If it’s done, I’ll reply to this post again. In my opinion, it would be better to add code to receive data in close wait status.

Hey Becky,

Thanks for your time on this topic.

Please take your time since it’s not a major requirement of my project. But we will add this feature later. I will also try to add receiving procedure in CLOSE WAITING STATUS.

Hi Becky,

Any update on the above issue? I’m facing with the same problem using the official driver and sample codes.
Please advise.