[Network] Transport Layer 3.1~3.2

0

Network

목록 보기
1/6
post-thumbnail
💡 트랜스포트 계층은 서로 다른 호스트에서 동작하는 애플리케이션 프로세스에게 직적 통신 서비스를 제공하는 중요한 기능을 갖는다.

3.1 Transport Layer Service and Introduction

트랜스포트 계층 프로토콜은 서로 다른 호스트에서 동작하는 애플리케이션 프로세스들에게 논리적 통신 (Logical Communication)을 제공한다.

논리적 통신은 호스트간에 직접 연결된것 처럼 보인다는걸 의미한다.

Transport layer protocols are implemented in end systems.

  • Sending: Application message is converted to segment → packet used in transport layer. The application message is broken to chunks and transport header is added. Then it is sent to network layer of end system and encapsulated as datagram.
  • Receiving: Network layer extracts the transport layer segment from the datagram, then pass it to its transport layer. Processes the data in the segment to the receiving application.

There can be multiple transport-layer protocols(TCP & UDP for internet). Each protocols provide different service for the application.

3.1.1 Relationship between Transport and Network layers

💡 Transport-layer provides logcal communication between **processes,** network layer between **hosts**.
  • Household and postal service example, one representative does house to house. To the rest of the people in the house, the representative is the postal service.
💡 application messages = letters in envelopes processes = cousins hosts (also called end systems) = houses transport-layer protocol = Ann and Bill network-layer protocol = postal service (including mail carriers)

Transport protocol lives in end systems, only responsible for moving application messages to network edge(layer). Does not know about network core system. Likewise, routers(network layer) do not relate with information from transport layer.

Service by the transport protocol is often constrained by the underlying network protocol (Information about delay, bandwidth guarantees). However, it can offer some services apart from the network layer such as reliable data transfer(TCP), and data encryption(ch8)

3.1.2 Overview of the Transport Layer in the Internet

💡 Internet makes two distinct transport layer protocols available to the application layer.
  • UDP (User Datagram Protocol): Unreliable, connectionless service.
  • TCP (Transmission Controll Protocol): Reliable, connection-oriented service.

Network application developers must choose between the two. (section 2.7 socket)

Segment → Packet for TCP & UDP

Datagram → Packet for Network Layer, Packet for UDP (RFC’s)

In the network layer, Internet Protocol trys but not guarantees delivery. Every host has IP address.

💡 Most fundamental responsibility of UDP and TCP is to extend IP’s delivery service between two end systems to delivery system between two processes. This is called **transport-layer multiplexing and demultiplexing.**

UDP is unreliable, unregulated ( can send data at any rate, any time)

TCP is reliable data transfer, uses flow control, sequence numbers, acknowledgements, timers, in order delivery, congestion control.

Congestion control is not really TCP exlclusive, but provided as a service for the Internet as a whole. TCP gives equal bandwidth to each connections by regulates rate of traffic from the sending side.

3.2 Multiplexing and Demultiplexing

💡 Multiplexing and Demultiplexing of transport layer is extension of host to host delivery by the network layer to process to process delivery for application services.

Transport layer in the receiving host does not deliver data to the process, but to its intermediary socket. Each socket has a unique identifier.

  • Demultiplexing: Delivering data in the transport layer segment to the correct socket.
  • Multiplexing: Gathering data chinks from host process’s sockets and encapsulating with header to create segments and passing it to network layer.

Mux, Demuxing is important in all layers.

  • Multiplexing Requirements

    • Sockets must have unique identifier

    • each segment have fields to indicate destination socket.

       - **Source port number & destination port number**
       - 16bit, 0 to 65535, 0~1023 are **well-known port numbers** (restricted, reserved) for well known protocols such as HTTP(80), FTP(21)
  • Demultiplexing

    • Each socket is assigned a port number.
    • Upon segment arrival, examine destination number and directs to corresponding socket.
    • Segment’s data is passed though the socket, to the process.

Connectionless Multi/Demultiplexing

#Exaple of socket creation and bind to port.
clientSocket = socket(AF_INET, SOCK_DGRAM)
clientSocket.bind((’’, 19157)

IP Address + Port number can specificcally target the process. Source port acts as a return address.

Connection-Oriented Multi/Demultiplexing

  • TCP socket is identified by a four tuple: Source IP address, source port, Destination IP addess, destination port.
  • All 4 information is used to demultiplex segment to the appropriate socket.

Handshaking Procedure

  1. Welcoming socket of the TCP server process binded to 12000 port.
  2. TCP client sends request
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName,12000))
  1. Client’s connection request is TCP segment with connection-establishment bit set in the header.
  2. Host OS locates the server process and create new socket.
connectionSocket, addr = serverSocket.accept()
  1. Transport layer at the server notes the four tuples. (IP-Source,Port-Source,Port-Dest,Own IP → Dest-IP)

  2. From then all arriving segments with same four identifiers will be demultiplex to the server socket.

  3. Client - Server now ready to send data.

    Even if host C and host A have same port number, it is not a problem for server B since they have different IP Address.

    Web Servers and TCP

    Figure 3.5 Server B created process for each connection but modern day high performance servers may just use one process and a thread for new connection. Therefore such servers may have a process with many sockets.

    Especially with non-persistent HTTP, when a process is created every time a new TCP connection, it impacts the performance of the server.

0개의 댓글