البروتوكول FTP موصف بالمستند :
http://tools.ietf.org/html/rfc959
هو ببساطة , لديك اثنين من الــ Sockets الأاولى لنقل الاوامر و الثانية لنقل البيانات ..
الأوامر مسبقة التعريف (هذا هو البروتوكول) و الرد على كل امر محدد ايضا مثلا :
Client: Connects to the FTP service at port 21 on the IP address 172.16.62.36.
Server: 220 Hello, this is the Acme Mail Service.
Client: USER MB1234
Server: 331 Password required to access user account MB1234.
Client: PASS QXJ4Z2AF Note that this password is not encrypted. The FTP is susceptible to eavesdropping!
Server: 230 Logged in.
Client: CWD Bills Change directory to "Bills."
Server: 250 "/home/MB1234/Bills" is new working directory.
Client: PORT 192,168,1,2,7,138 The client wants the server to send to port number 1930 on IP address 192.168.1.2. In this case, 192.168.1.2 is the IP address of the client machine.
Server: 200 PORT command successful.
Client: LIST Send the list of files in "Bills."
Server: 150 Opening ASCII mode data connection for /bin/ls. The server now connects out from its port 20 on 172.16.62.36 to port 1930 on 192.168.1.2.
Server: 226 Listing completed. That succeeded, so the data is now sent over the established data connection.
Client: PORT 192,168,1,2,7,139 The client wants the server to send to port number 1931 on the client machine.
Server: 200 PORT command successful.
Client: RETR Yoyodyne.TXT Download "Yoyodyne.TXT."
Server: 150 Opening ASCII mode data connection for Yoyodyne.TXT. The server now connects out from its port 20 on 172.16.62.36 to port 1931 on 192.168.1.2.
Server: 226 Transfer completed. That succeeded, so the data is now sent over the established data connection.
Client: QUIT
Server: 221 Goodbye.
الكود : client.c