宝塔Linux面板的防火墙,对FTP的主动模式有影响经常在读取完目录后,返回“227 Entering Passive Mode (122,152,224,215,153,46)”。
net version:16
mac addr:38 3b 26 26 8 28
WCHNET_LibInit Success
SocketId TCP Open = 00
PHY Link Success
ftp sockid:0,21
check type= 01
len= 00000320
LOG:
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 16:11. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
ftp sockid:0,21
check type= 01
len= 00000041
LOG:
331 User Firmware OK. Password required
ftp sockid:0,21
check type= 01
len= 00000032
LOG:
230 OK. Current directory is /
************
login success
*********
login!
ftp sockid:0,21
check type= 02
len= 00000030
LOG:
200 TYPE is now 8-bit binary
TmpSocketInf.SourPort:39000
SocketId dat server:1
PORT :PORT 192,168,2,129,152,88
TCP Disconnect
ftp sockid:0,21
MQTT MyBuf:3
check type= 02
len= 00000043
LOG:
250 OK. Current directory is /HC-05-E2001
ftp sockid:0,21
check type= 02
len= 00000029
LOG:
200 PORT command successful
ftp sockid:0,21
check type= 02
len= 00000045
LOG:
257 "/HC-05-E2001" is your current location
ftp sockid:0,21
check type= 02
len= 00000030
LOG:
150 Connecting to port 26694
ftp sockid:0,21
check type= 02
len= 00000039
LOG:
226-Options: -l
226 3 matches total
TCP_FTP Connect Success
WCHNET_GetSockeID:2
ftp sockid:2,20
check type= 02
len= 00000230
LOG:
-rw-r--r-- 1 1000 www 164400 Oct 24 13:31 20231020v1.11.bin
-rw-r--r-- 1 1000 www 158275 Oct 13 17:07 48595.txt
-rw-r--r-- 1 1000 www 1527 Oct 12 12:21 FTP_TYGV.txt
Verify_SoftwareVersion:0
ftp sockid:0,21
MQTT MyBuf:3
check type= 02
len= 00000045
LOG:
227 Entering Passive Mode (10,0,8,4,154,84)
FTPCheckSearch_227 ftp.SouPort:39508
TCP Disconnect
SocketId TCP Close = 01
**********
search success
*********
Search File!
使用“WCHNET_FTPDatServer()”中的“WCHNET_SocketCreat()”对“227”返回的端口号进行设置会提示“WCHNET_ERR_MEM”或“WCHNET_ERR_CLSD”。
并且使用例程的“WCHNET_FTPGetFile()”下载指定文件很容易没有反应,状态机无法正常运行。