1 of 52

Computer Networks�Lecture - 03

2 of 52

Functions of Application Layers

  • Identifying communication partners: The application layer identifies the availability of communication partners for an application with data to transmit.

  • Determining resource availability: The application layer determines whether sufficient network resources are available for the requested communication.

  • Synchronizing communication: All the communications occur between the applications requires cooperation which is managed by an application layer.

2

3 of 52

Services of Application Layers

  • Network Virtual terminal: An application layer allows a user to log on to a remote host. To do so, the application creates a software emulation of a terminal at the remote host. The user's computer talks to the software terminal, which in turn, talks to the host. The remote host thinks that it is communicating with one of its own terminals, so it allows the user to log on.

  • File Transfer, Access, and Management (FTAM): An application allows a user to access files in a remote computer, to retrieve files from a computer and to manage files in a remote computer. FTAM defines a hierarchical virtual file in terms of file structure, file attributes and the kind of operations performed on the files and their attributes.

3

4 of 52

Services of Application Layers

  • Addressing: To obtain communication between client and server, there is a need for addressing. When a client made a request to the server, the request contains the server address and its own address. The server response to the client request, the request contains the destination address, i.e., client address. To achieve this kind of addressing, DNS is used.
  • Mail Services: An application layer provides Email forwarding and storage.
  • Directory Services: An application contains a distributed database that provides access for global information about various objects and services.
  • Authentication: It authenticates the sender or receiver's message or both.

4

5 of 52

Application architectures

  • Client-server
  • Peer-to-peer (P2P)
  • Hybrid of client-server and P2P

5

6 of 52

Client-server architecture

server:

    • always-on host
    • permanent IP address
    • server farms for scaling

clients:

    • communicate with server
    • may be intermittently connected
    • may have dynamic IP addresses
    • do not communicate directly with each other

6

7 of 52

Characteristics of Client-server architecture

  • In Client-server architecture, clients do not directly communicate with each other. For example, in a web application, two browsers do not directly communicate with each other.

  • A server is fixed, well-known address known as IP address because the server is always on while the client can always contact the server by sending a packet to the sender's IP address.

7

8 of 52

Advantages of Client-server architecture

  • Centralized: Centralized backup is possible in client-server networks, i.e., all the data is stored in a server.

  • Security: These networks are more secure as all the shared resources are centrally administered.

  • Performance: The use of the dedicated server increases the speed of sharing resources. This increases the performance of the overall system.

  • Scalability: We can increase the number of clients and servers separately, i.e., the new element can be added, or we can add a new node in a network at any time.

8

9 of 52

Disadvantages of Client-server architecture

  • Traffic Congestion is a big problem in Client/Server networks. When a large number of clients send requests to the same server may cause the problem of Traffic congestion.
  • It does not have a robustness of a network, i.e., when the server is down, then the client requests cannot be met.
  • A client/server network is very decisive. Sometimes, regular computer hardware does not serve a certain number of clients. In such situations, specific hardware is required at the server side to complete the work.
  • Sometimes the resources exist in the server but may not exist in the client. For example, If the application is web, then we cannot take the print out directly on printers without taking out the print view window on the web.

9

10 of 52

Pure P2P architecture

  • no always on server
  • arbitrary end systems directly communicate
  • peers are intermittently connected and change IP addresses
  • example: Gnutella

Highly scalable

But difficult to manage

10

11 of 52

Features of P2P architecture

  • Self scalability: In a file sharing system, although each peer generates a workload by requesting the files, each peer also adds a service capacity by distributing the files to the peer.

  • Cost-effective: It is cost-effective as it does not require significant server infrastructure and server bandwidth.

11

12 of 52

Hybrid of client-server and P2P

  • Napster
      • File transfer P2P
      • File search centralized:
        • Peers register content at central server
        • Peers query same central server to locate content
  • Instant messaging
      • Chatting between two users is P2P
      • Presence detection/location centralized:
        • User registers its IP address with central server when it comes online
        • User contacts central server to find IP addresses of buddies

12

13 of 52

Processes communicating

Process: program running within a host.

  • within same host, two processes communicate using inter-process communication (defined by OS).
  • processes in different hosts communicate by exchanging messages

Client process: process that initiates communication

Server process: process that waits to be contacted

13

  • Note: applications with P2P architectures have client processes & server processes

14 of 52

Sockets

  • process sends/receives messages to/from its socket
  • socket analogous to door
    • sending process shoves message out door
    • sending process relies on transport infrastructure on other side of door which brings message to socket at receiving process

14

process

TCP with

buffers,

variables

socket

host or

server

process

TCP with

buffers,

variables

socket

host or

server

Internet

controlled

by OS

controlled by

app developer

  • API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later)

15 of 52

Port Numbers

  • A port number is a way to identify a specific process to which an internet or other network message is to be forwarded when it arrives at a server.
  • All network-connected devices come equipped with standardized ports that have an assigned number.
  • These numbers are reserved for certain protocols and their associated function.
  • Ports are identified with positive 16-bit unsigned integers, ranging from 0 to 65535.
  • Port numbers are divided into three ranges:
    • well-known ports /system ports (0 - 1023)
    • registered ports
    • dynamic or private ports.

15

16 of 52

IANA Ranges

  • The IANA (Internet Assigned Number Authority) has divided the port numbers into three ranges: well known, registered, and dynamic (or private), as shown in Figure below.

  • Well-known ports: The ports ranging from 0 to 1023 are assigned and controlled by IANA. These are the well-known ports. Reserved for most universal applications.

  • Hypertext Transfer Protocol (HTTP) application has the port number of 80; and the Post Office Protocol Version 3 (POP3) application, commonly used for e-mail delivery, has the port number of 110.

16

17 of 52

IANA Ranges

  • Registered ports: The ports ranging from 1024 to 49,151 are not assigned or controlled. By IANA. They can only be registered with IANA to prevent duplication. The applications using these ports run as ordinary programs that can be started by nonprivileged users.

  • Dynamic ports: The ports ranging from 49,152 to 65,535 are neither controlled nor registered. They can be used by any process. These are the ephemeral ports.

17

18 of 52

Port Numbers

18

19 of 52

HTTP

  • HTTP stands for Hypertext Transfer Protocol.
  • It is the foundation of the World Wide Web (WWW).
  • HTTP works on the client server model.
  • This protocol is used for transmitting hypermedia documents like HTML.
  • This protocol was designed particularly for the communications between the web browsers and web servers, but this protocol can also be used for several other purposes.
  • HTTP is a stateless protocol (network protocol in which a client sends requests to server and server responses back as per the given state), which means the server is not responsible for maintaining the previous client’s requests.
  • HTTP uses port number 80.

19

20 of 52

Features of HTTP:

  • Connectionless protocol: HTTP is a connectionless protocol. HTTP client initiates a request and waits for a response from the server. When the server receives the request, the server processes the request and sends back the response to the HTTP client after which the client disconnects the connection. The connection between client and server exist only during the current request and response time only.
  • Media independent: HTTP protocol is a media independent as data can be sent as long as both the client and server know how to handle the data content. It is required for both the client and server to specify the content type in MIME-type header.
  • Stateless: HTTP is a stateless protocol as both the client and server know each other only during the current request. Due to this nature of the protocol, both the client and server do not retain the information between various requests of the web pages.

20

21 of 52

HTTP Transactions

  • The above figure shows the HTTP transaction between client and server. The client initiates a transaction by sending a request message to the server. The server replies to the request message by sending a response message.

21

22 of 52

Messages

  • HTTP messages are of two types: request and response. Both the message types follow the same message format.

22

23 of 52

Messages

  • Request Message: The request message is sent by the client that consists of a request line, headers, and sometimes a body.

23

24 of 52

Messages

  • Response Message: The response message is sent by the server to the client that consists of a status line, headers, and sometimes a body.

24

25 of 52

Uniform Resource Locator (URL)

  • A client that wants to access the document in an internet needs an address and to facilitate the access of documents, the HTTP uses the concept of Uniform Resource Locator (URL).
  • The Uniform Resource Locator (URL) is a standard way of specifying any kind of information on the internet.
  • The URL defines four parts: method, host computer, port, and path.

25

26 of 52

Uniform Resource Locator (URL)

  • Method: The method is the protocol used to retrieve the document from a server. For example, HTTP.
  • Host: The host is the computer where the information is stored, and the computer is given an alias name. Web pages are mainly stored in the computers and the computers are given an alias name that begins with the characters "www". This field is not mandatory.
  • Port: The URL can also contain the port number of the server, but it's an optional field. If the port number is included, then it must come between the host and path and it should be separated from the host by a colon.
  • Path: Path is the pathname of the file where the information is stored. The path itself contain slashes that separate the directories from the subdirectories and files.

26

27 of 52

FTP

  • FTP stands for File Transfer Protocol.

  • This protocol helps to transfer different files from one device to another.

  • FTP promotes sharing of files via remote computer devices with reliable, efficient data transfer.

  • FTP uses port number 20 for data access and port number 21 for data control.

27

28 of 52

FTP

28

29 of 52

Types of connections in FTP

  • Control Connection: The control connection uses very simple rules for communication. Through control connection, we can transfer a line of command or line of response at a time. The control connection is made between the control processes. The control connection remains connected during the entire interactive FTP session.

  • Data Connection: The Data Connection uses very complex rules as data types may vary. The data connection is made between data transfer processes. The data connection opens when a command comes for transferring the files and closes when the file is transferred.

29

30 of 52

FTP Clients

  • FTP client is a program that implements a file transfer protocol which allows you to transfer files between two hosts on the internet.

  • It allows a user to connect to a remote host and upload or download the files.

  • It has a set of commands that we can use to connect to a host, transfer the files between you and your host and close the connection.

  • The FTP program is also available as a built-in component in a Web browser. This GUI based FTP client makes the file transfer very easy and also does not require to remember the FTP commands.

30

31 of 52

Advantages of FTP

  • Speed: One of the biggest advantages of FTP is speed. The FTP is one of the fastest way to transfer the files from one computer to another computer.
  • Efficient: It is more efficient as we do not need to complete all the operations to get the entire file.
  • Security: To access the FTP server, we need to login with the username and password. Therefore, we can say that FTP is more secure.
  • Back & forth movement: FTP allows us to transfer the files back and forth. Suppose you are a manager of the company, you send some information to all the employees, and they all send information back on the same server.

31

32 of 52

Disadvantages of FTP

  • The standard requirement of the industry is that all the FTP transmissions should be encrypted. However, not all the FTP providers are equal and not all the providers offer encryption. So, we will have to look out for the FTP providers that provides encryption.
  • FTP serves two operations, i.e., to send and receive large files on a network. However, the size limit of the file is 2GB that can be sent. It also doesn't allow you to run simultaneous transfers to multiple receivers.
  • Passwords and file contents are sent in clear text that allows unwanted eavesdropping. So, it is quite possible that attackers can carry out the brute force attack by trying to guess the FTP password.
  • It is not compatible with every system.

32

33 of 52

E-Mail access protocols

  • SMTP: delivery/storage to receiver’s server
  • Mail access protocol: retrieval from server
    • POP: Post Office Protocol [RFC 1939]
      • authorization (agent <-->server) and download
    • IMAP: Internet Mail Access Protocol [RFC 1730]
      • more features (more complex)
      • manipulation of stored messages on server
    • HTTP: Hotmail , Yahoo! Mail, etc.

33

user

agent

sender’s mail

server

user

agent

SMTP

SMTP

access

protocol

receiver’s mail

server

34 of 52

SMTP

  • SMTP stands for Simple Mail Transfer Protocol.
  • SMTP is a set of communication guidelines that allow software to transmit an electronic mail over the internet is called Simple Mail Transfer Protocol.
  • It is a program used for sending messages to other computer users based on e-mail addresses.
  • It provides a mail exchange between users on the same or different computers, and it also supports:
    • It can send a single message to one or more recipients.
    • Sending message can include text, voice, video or graphics.
    • It can also send the messages on networks outside the internet.
  • The main purpose of SMTP is used to set up communication rules between servers.

34

35 of 52

Components of SMTP

35

36 of 52

Components of SMTP

  • First, we will break the SMTP client and SMTP server into two components such as user agent (UA) and mail transfer agent (MTA). The user agent (UA) prepares the message, creates the envelope and then puts the message in the envelope. The mail transfer agent (MTA) transfers this mail across the internet.

36

37 of 52

Components of SMTP

  • SMTP allows a more complex system by adding a relaying system. Instead of just having one MTA at sending side and one at receiving side, more MTAs can be added, acting either as a client or server to relay the email.

37

38 of 52

Components of SMTP

  • The relaying system without TCP/IP protocol can also be used to send the emails to users, and this is achieved by the use of the mail gateway. The mail gateway is a relay MTA that can be used to receive an email.

38

39 of 52

Working of SMTP

  • Composition of Mail: A user sends an e-mail by composing an electronic mail message using a Mail User Agent (MUA). Mail User Agent is a program which is used to send and receive mail. The message contains two parts: body and header. The body is the main part of the message while the header includes information such as the sender and recipient address. The header also includes descriptive information such as the subject of the message. In this case, the message body is like a letter and header is like an envelope that contains the recipient's address.

  • Submission of Mail: After composing an email, the mail client then submits the completed email to the SMTP server by using SMTP on TCP port 25.

39

40 of 52

Working of SMTP

  • Delivery of Mail: E-mail addresses contain two parts: username of the recipient and domain name. For example, dipjol@gmail.com, where " dipjol " is the username of the recipient and "gmail.com" is the domain name.
  • If the domain name of the recipient's email address is different from the sender's domain name, then MSA will send the mail to the Mail Transfer Agent (MTA). To relay the email, the MTA will find the target domain. It checks the MX record from Domain Name System to obtain the target domain. The MX record contains the domain name and IP address of the recipient's domain. Once the record is located, MTA connects to the exchange server to relay the message.
  • Receipt and Processing of Mail: Once the incoming message is received, the exchange server delivers it to the incoming server (Mail Delivery Agent) which stores the email where it waits for the user to retrieve it.
  • Access and Retrieval of Mail: The stored email in MDA can be retrieved by using MUA (Mail User Agent). MUA can be accessed by using login and password.

40

41 of 52

DNS

  • DNS stands for Domain Name System.

  • The DNS service translates the domain name (selected by user) into the corresponding IP address.

  • For example- If you choose the domain name as www.abcd.com, then DNS must translate it as 192.36.20.8 (random IP address written just for understanding purposes).

  • DNS protocol uses the port number 53.

41

42 of 52

DNS

42

43 of 52

DNS

  • DNS is a TCP/IP protocol used on different platforms. The domain name space is divided into three different sections: generic domains, country domains, and inverse domain.

43

44 of 52

DNS

  • Generic Domains:
    • It defines the registered hosts according to their generic behavior.

    • Each node in a tree defines the domain name, which is an index to the DNS database.

    • It uses three-character labels, and these labels describe the organization type.

44

45 of 52

DNS

  • Country Domain
    • The format of country domain is same as a generic domain, but it uses two-character country abbreviations (e.g., us for the United States) in place of three character organizational abbreviations.
  • Inverse Domain
    • Inverse Domain Inverse domain is used to map an address to a name. If a server requests a service from clients and the server has a list of authorized clients [IP addresses], then it needs inverse mapping. Inverse or pointer query. Hierarchical: Net-id part is at higher level than the subnet-id part. 132.34.45.121  121.45.34.132.in-addr.arpa Use the ns-lookup command to map an IP address to a name.

45

46 of 52

SNMP

  • SNMP stands for Simple Network Management Protocol.

  • This protocol gathers data by polling the devices from the network to the management station at fixed or random intervals, requiring them to disclose certain information.

  • SNMP uses port numbers 161 (TCP) and 162 (UDP)

46

47 of 52

SNMP Components

  • SNMP-managed devices and resources—These are the devices and network elements on which an agent runs.

  • SNMP agent—This software runs on the hardware or service being monitored by SNMP, collecting data on various metrics like CPU usage, bandwidth usage or disk space.

  • SNMP manager—(also referred to as SNMP server) This component functions as a centralized management station running an SNMP management application on many different operating system environments. It actively requests agents send SNMP updates at regular intervals.

47

48 of 52

SNMP Components

  • Management information base (MIB)—This data structure is a text file (with a .mib file extension) that describes all data objects used by a particular device that can be queried or controlled using SNMP including access control.
  • Each agent has its own MIB, which is a collection of all the objects that the manager can manage. MIB is categorized into eight groups: system, interface, address translation, ip, icmp, tcp, udp, and egp. These groups are under the mib object.

48

49 of 52

SNMP Commands

  • Get Request—A request to retrieve the value of a variable or list of variables.
  • Set Request—Sent by the SNMP manager to the agent to issue configurations or commands.
  • Get Next Request—Sent by the SNMP manager to agent to find the values of the next record in the MIB's hierarchy.
  • Get Bulk Request—Sent by the SNMP manager to the agent to obtain large tables of data by performing multiple Get Next Request commands.
  • SNMP Response—Sent by the agent to the SNMP manager, issued in reply to a
  • SNMP Trap—Asynchronous trap messages from SNMP agents alert an SNMP manager that a significant event such as an error or failure, has occurred.
  • SNMP Inform—Confirms receipt of a trap.

49

50 of 52

Socket Programming

  • Socket programming is a way of connecting two nodes on a network to communicate with each other.

  • One socket(node) listens on a particular port at an IP, while the other socket reaches out to the other to form a connection.

  • The server forms the listener socket while the client reaches out to the server.

50

51 of 52

State diagram for server and client model

51

52 of 52

Thanks!

Any questions?

You can find me at:

minhazularefin21@gmail.com

52