FTPS 통신연습 – File Download
FTP (File Transfer Protocol) is an application layer protocol.
File Transfer Protocol is a standard protocol for transferring files over a network, using the client/server mode.
1. FTP(S) Characteristics
A control connection is a communication link established between a client protocol interpreter and a server protocol interpreter
for exchanging commands and responses.
A data connection is a full-duplex connection for transmitting data.
The transfer of data can occur between DTP for the server data transfer process and DTP for the client,
or between DTP for the two server
2. FTP(S) 통신 설정과정
FTP(S) 통신의 가장 단순한 설정과정은 아래 순서도를 참조할 수 있다.
3. 통신 명령시퀀스 – FTP(S) File Download
FTP(S) 서버로 부터 파일을 다운로드 하는 예는 다음과 같다..
NO | Command | Response | 설명 |
1 | PDP Context 설정 | ||
2 | AT+CFTPSSTAR | +CFTPSSTART: 0 OK |
Activate PDP context to start FTP service |
3 | AT+CFTPSSINGLEIP=1 | OK |
Set data connection, use the same port(address) of control connection |
4 |
AT+CFTPSLOGIN=”test.rebex.net”, 21,”demo”,”password”,0 |
OK +CFTPSLOGIN: 0 |
|
5 | AT+CFTPSLIST=”/” | List all items of directory “/” of FTP server | |
6 | AT+CFTPSPWD | OK +CFTPSPWD: “/” |
Get current directory of FTP server |
7 | AT+CFTPSGETFILE=”readme.txt” | OK +CFTPSGETFILE: 0 |
Download a file from FTP server |
AT+CFTPSABORT | Abort FTP(S) operation | ||
AT+FSCD? | Query current client directory | ||
AT+FSCD=F:/ | +FSCD: F:/ OK |
Change current directory to “F:/” | |
8 | AT+FSLS | List all items in directory “F:/” | |
9 | AT+CFTPSLOGOUT | OK +CFTPSLOGOUT: 0 |
Logout FTP server |
10 | AT+CFTPSSTOP | +CFTPSSTOP: 0 OK |
Stop FTP service |