Application Layer I Flashcards
(14 cards)
Communicating processes
Processes in different
hosts communicate by
exchanging messages
Messages go through
the protocol stack
Header encapsulation/decapsulation
This is used to achieve
separation of concerns between each layer
Identifying processes remotely
A process is addressed over the network using two
identifiers:
– IP address
* Network Layer identifier
* 32 bits (IPv4) or 64 bits (IPv6)– Port number
* Transport Layer identifier (16 bits)
– IP address is used by routers to forward messages to the correct host
– Then, the host’s OS uses the port number to forward messages to the
correct target process/ socket
Sockets: The interface between Processes and Transport Protocols
The OS provides a so-called “socket” interface
Processes send/receive
messages to/from sockets
Client process: Initiates
communication
Server process: Waits to be contacted
Port numbers
well known ports(common ones): range from 0- 1023
and
uncommon ones range from 1024-65535
UNIX’s Socket API
In UNiX, almost every resource and device is made to look like a file
▪ A socket is like a file
- E.g., ‘standard’ API calls (“system calls”) are used - like read(), write(), close()
- Plus some other socket-specific calls: send(), recv(), bind(), etc
Application layer protocols
Define types of messages: e.g., request, response, add-user.
Specify message structure:
Syntax: what fields are in a message.
Semantics: meaning of each field.
Control communication rules:
When and how messages are sent and responded to.
Types:
Open protocols: Publicly defined (e.g., HTTP, SMTP), ensure compatibility between systems.
Proprietary protocols: Private, product-specific (e.g., Skype, AppleTalk).
What might an application need from
a transport service?
Data integrity
– Some apps require 100%
reliable data transfer (e.g.
file transfer, web
transactions)
– Other apps (e.g., audio) can tolerate some loss
Throughput(data per second)
- Some apps require a
minimum level of throughput
(e.g. multimedia)
- Other apps can make use of whatever throughput they get (“elastic apps”)
Timing– Some apps (e.g., Internet
telephony, interactive
games) require low delay
Security- Encryption, data
integrity
Internet transport protocols
TCP service:
- Reliable transport between sending and
receiving process - All messages are delivered in the
order they were sent - Flow control: sender can’t overwhelm
receiver
Connection-oriented: initial setup is required
between client and server processes
- Does not provide: timeliness, minimum
throughput guarantee, security
UDP service:
Unreliable data transfer between
sending and receiving process
- Does not provide: reliability, in-order
delivery, flow control, congestion
control, timeliness, throughput
guarantee, security, or connection
setup
BUT timeliness may be better than
TCP; and less overhead may be
incurred for both hosts and the
network
Socket programming with TCP
TCP service is connection-oriented:
– When a client application creates a socket, the client’s
TCP instance establishes a connection to the server’s TCP instance
When contacted by a client, a server TCP creates a new
socket for server process to communicate with that specific
client
Raw Sockets
Commonly used for implementing custom network protocols and
capturing incoming ICMP packets
- ICMP packets do not contain a transport layer
- Therefore, they do not include port numbers
- This means ICMP packets are not sent to a process
By setting the value of the protocol as socket.IPPROTO_ICMP, you can capture all the ICMP traffic on your host
- Typically requires elevated privileges (administrator/root) to create
raw sockets due to security concerns
Client-Server architecture
Server:
–An always-on host
–Has permanent IP address
–(Can use data centres for scaling)
- Clients:
– system is not always connected to the network
–Private/ephemeral IP addresses
–Do not communicate directly
with each other
P2P architecture(s)
No always-on central server.
Devices (peers) talk to each other directly.
Each peer can request and provide services (like sharing files).
Scales well: new peers bring more demand and capacity.
Peers may be online only sometimes and their IP addresses change, making it harder to manage.