DEV Community

mohandass
mohandass

Posted on

WHAT IS FTP,TCP

1. File Transfer Protocol(FTP)

  • File transfer protocol(FTP) is an application layer protocol that Used to file transfer between client and a server over a TCP,IP Network.It's provide a standardized method for file exchange across Different system.

    • Support text,image,binary,and program files.
    • Enable uploading,downloading,and remote file management.
    • Used to TCP for ensure reliable communication.

Working and Uses of FTP

  • FTP follows a client-server model and uses two connections

  • Control connection (port 21) for commends.

  • Data connection(port 20)for file transfer.

  • User connect to the server use login credentials.

  • User navigate directories used commends ls and cd.

  • Using for transferring files uses get and put.

  • supports both active and passive mods for communication.


         control channel 
client -------------------> sever 
       <------------------                     
           Data channel 

Enter fullscreen mode Exit fullscreen mode

Types of Connection in FTP

  • FTP use two separate TCP connection to handle communication one dedicating to control information and another dedicating to actual data transfer

  • Control connection

  • data connection

FTP Data Types

FTP data types define how file contents are represented and transmitted between the client and server during file transfer.

  1. ASCII: This data type is used for transferring text files with character encoding based on the ASCII standard.

  2. EBCDIC: This data type is used for transferring text files encoded in IBM’s Extended Binary Coded Decimal Interchange Code.

  3. Image (Binary): This data type transfers files as a continuous stream of bytes without any modification.

  4. Local: This data type is used for transferring files that contain data stored in logical bytes of a specified bit length.

FTP common commends

  • get filename - download a single file in the server.

  • mget filename - download a multiple files form the server.

  • ls - used for list of the files in the current server directory.

Types of FTP

  • Anonymous FTP

  • Password-Protected FTP

  • FTPS (FTP Secure)

  • SFTP (SSH File Transfer Protocol)
    (TBD)

2. Transmission control protocol(TCP)

Transmission control protocol is the protocol that allow the device communicate reliable a network.It is ensure that data reaches the destination correctly and a right order.Even the part of the network slow and unreliable.

  • It works at the Transport Layer (Layer 4) of the OSI model and is an essential part of the TCP/IP protocol suite used for Internet communication.
  • TCP establishes a logical connection between the sender and receiver before data transmission begins.
  • It ensures that data is delivered accurately and in the same order in which it was sent using acknowledgements and sequence numbers.
  • TCP detects errors using checksums and retransmits lost or corrupted packets to maintain data integrity.
  • It controls the data transmission rate to avoid overwhelming the receiver and adapts to network congestion for efficient communication.

Connection Establishment (Three-Way Handshake)

TCP is connection-orientated, meaning a connection must be established before any data is sent. This is done using a three-way handshake

TCP Handshake process

           FIN-ACK
       -------------->
             ACK
       <------------- 
           ACK-FIN
 Client<--------------Server  
             ACK
      --------------->
Enter fullscreen mode Exit fullscreen mode

Step 1: FIN (Client → Server): The client sends a FIN segment to initiate closure, entering the FIN-WAIT-1 state.

Step 2: ACK (Server → Client): The server sends an ACK to acknowledge the FIN. The server enters CLOSE-WAIT (can still send data), and the client enters FIN-WAIT-2.

Step 3: FIN (Server → Client): Once the server finishes sending remaining data, it sends its own FIN segment to the client.

Step 4: ACK (Client → Server): The client sends an ACK to acknowledge the server's FIN, entering the TIME-WAIT state. After a set period, the connection is fully closed.

WORKING

  1. Segmenting

  2. Routing via IP

  3. Reassembly at Receiver

  4. Acknowledgments (ACKs)

  5. Retransmission

  6. Flow & Error Control
    (TBD)

REFERENCE:https://www.geeksforgeeks.org/

Top comments (0)