ELEC3506

Topics

Application LayerLecture 8 PDF15 min

Application paradigms and sockets

Where the application layer sits, how client-server differs from peer-to-peer, what a socket is, and how an application chooses TCP or UDP.

By the end of this page you should be able to

  • State what the application layer provides and what it receives from the transport layer
  • Compare the client-server and peer-to-peer paradigms, with an example and a drawback of each
  • Explain what a socket is and why the lecture calls it an abstraction
  • Match an application to the transport protocol that suits it, using its loss and timing needs

The idea

Everything below the application layer exists so that a program on one host can talk to a program on another. The application layer is the part users actually touch: the browser, the mail client, the file transfer tool. It asks the transport layer for service and gets nothing else from below.

Two questions shape every application protocol in this module. Who starts the conversation and who waits for it? And which transport protocol carries it, TCP or UDP? The rest of the module is a tour of the standard answers.

How it works

Where the application layer sits

The lecture places the application layer at the top of the TCP/IP suite. It provides services to Internet users and receives services from the transport layer. The other four layers make the application layer’s services possible.

Each lower layer has a narrower job:

  • The data link layer (Layer 2) is node to node communication.
  • The network layer (Layer 3) is host to host communication.
  • The transport layer is process to process communication. It provides logical communication between applications or processes running on different hosts.

At the application layer the connection between two processes is logical. The two ends behave as if they talk directly, though the data crosses every layer below.

How it works

Adding and removing protocols

The layered design lets the Internet add, remove or replace a protocol in any layer. The lecture gives the conditions:

  • A protocol added to a layer must use the services of a protocol in the layer below.
  • Removing a protocol means changing whichever protocol in the next layer up used its services.
  • Application layer protocols provide services to no other protocol in the suite, so they can be removed easily.
  • New application layer protocols can be added easily as long as they can use the services of the transport layer protocols.

How it works

Client-server and peer-to-peer

In the client-server paradigm the service is provided by a server process, and that process must be running all the time. The client initiates contact and requests service. The server provides the requested service. The lecture’s examples are the World Wide Web, the file transfer protocol (FTP) and email.

In the peer-to-peer (P2P) paradigm there is no central server. Responsibility is shared between peers, and a computer can both provide and receive services. The lecture’s examples are Skype, BitTorrent, IPTV and Internet telephony.

Client-serverPeer-to-peer
Central serverYes, running at all timesNone
Who provides serviceThe serverAny peer, which can also receive service
ExamplesWorld Wide Web, FTP, emailSkype, BitTorrent, IPTV, Internet telephony
DrawbacksNeeds a powerful server because load concentrates there. The server may break down. Only suits services that can return some type of income.Security and applicability
StrengthsNot listed on the slideScales well and is cost-effective
The two paradigms as the lecture sets them side by side.

How it works

Client-server programming and the socket interface

A client-server program needs a set of instructions that tell the lowest four layers of the TCP/IP suite to open the connection, send and receive data from the other end, and close the connection. These instructions form an Application Programming Interface (API). It sits between the process at the application layer and the operating system, which encapsulates the lower four layers.

The socket interface is one such API. A socket is not a physical entity. It is an abstraction, created and used by the application program. The application can use a socket the same way it uses other data sources and sinks.

For process-to-process communication, the application layer sees only two sockets. The client treats its socket as the thing that gives the response. The server treats its socket as the thing that sends the request. Two processes communicate through a pair of socket addresses.

How it works

Choosing a transport protocol

When you write a new application you decide which transport protocol it uses, and the choice seriously affects what the application processes can do. The lecture lists the two options:

  • TCP: connection-oriented, reliable, with flow control, error control and congestion control.
  • UDP: connectionless, unreliable, simple, small delay and low overhead.

The standards table in the lecture pairs common applications with their protocol. Its columns extracted interleaved from the slide, so the pairing below follows the row order of the extraction.

ApplicationApplication protocolTransportIETF standard
Email transferSMTPTCP (port 25, per the SMTP slide)RFC 821 / 5321 / 6409
Email deliveryPOP3 / IMAP4TCPRFC 1939 / RFC 3501
Remote accessTelnetTCPRFC 854
Remote accessSSHTCPRFC 4251
WebHTTP 1.1 / 2.0TCPRFC 2068 / 7230 / 7235, RFC 7540
File transferFTPTCPRFC 959
File transferSFTPTCPTunneled in SSH
Instant messagingXMPPTCPRFC 6120 / 6121
VoIPSIPTCP / UDPRFC 3261
Video streamingRTSPRTP / UDPRFC 2326 / 3550
Reconstructed from a table whose columns extracted out of alignment. Treat the row pairing as likely, not certain.

How it works

Transport service requirements

Applications differ in what they need from the transport layer: whether data loss is acceptable, how much bandwidth they use, and whether timing matters. The lecture’s table is badly scrambled in the extraction, so only the readings that are unambiguous are given here.

  • Email, web and file transfer need no data loss, take elastic bandwidth (they use what is available) and are not time sensitive.
  • Remote access needs no data loss, with elastic bandwidth and a timing need under 150 ms.
  • VoIP is loss tolerant. The lecture quotes 150 ms with an ITU-T reference, and audio and video bandwidth ranges (5 Kb to 1 Mb for audio, 1 Kb to 5 Mb for video as the slide prints them).
  • Interactive games are given as ~100 ms. Financial applications are marked “Depends” for timing.

Where marks get lost

A table column you cannot trust

Do not memorise a loss, bandwidth and timing row for every application from this page. The slide’s table did not survive text extraction, and this page does not fill the gaps from memory. If a question asks for the full table, check the lecture slide itself.

In the exam

  • Layer scope: data link is node to node, network is host to host, transport is process to process.
  • Client-server: the server must run all the time and the client starts the contact. Know all three drawbacks, including that it only suits services that can return some income.
  • P2P: no central server, shared responsibility, scales well and is cost-effective, with security and applicability as the cons.
  • Socket: say “abstraction” and “API between the application process and the operating system”. Not a physical entity.
  • TCP versus UDP: TCP is connection-oriented and reliable with three controls (flow, error, congestion). UDP is connectionless and unreliable with small delay and low overhead.

Aside

The lecture describes the socket interface in concept only. It names no socket functions and shows no code, so none are given here.

Check yourself

  • The application layer provides services to users and receives them from the transport layer. Transport is process to process, network is host to host, data link is node to node.
  • Client-server needs an always-running server and concentrates load. P2P has no central server and trades that for security and applicability problems.
  • A socket is an abstraction, the API between an application process and the operating system.
  • TCP gives reliability and three controls. UDP gives small delay, simplicity and low overhead.

Check yourself

  1. Which statement about the client-server paradigm matches the lecture?
  2. Which pair lists the two cons the lecture gives for peer-to-peer?
  3. What is a socket, according to the lecture?
  4. Which layer provides communication between processes running on different hosts?
  5. Why can a new application layer protocol be added without changing other protocols?