Uploaded by Megane Cws

9618 Computer Science Chapter 14

advertisement
Chapter 14 - Communication and Internet
Technologies
Computer Science A2 Level
1. Protocols
●
●
●
●
●
●
show understanding of why a protocol is essential for communication between computers
show understanding of how protocol implementation can be viewed as a stack, where each layer
has its own functionality
show understanding of the function of each layer of the TCP/IP protocol
show understanding of the application of the TCP/IP protocol when a message is sent from one
host to another on the internet
show understanding of how the BitTorrent protocol provides peer-to-peer file sharing
show an awareness of other protocols (HTTP, FTP, POP3/4, SMTP) and their purposes
1. Protocols
●
●
●
●
●
●
●
●
●
protocol → set of rules governing communication across a network → they must be agreed by both sender and receiver
protocols can define: transmission speed, rules of the format of the message, if transmission has even or odd parity, …
protocol suite → collection of related protocols made up of different levels that compound a stack → each level has a
function and communicates with levels above and below it → Transmission Control Protocol/Internet Protocol (TCP/IP)
TCP/IP comprises several protocols and layers (each layer is implemented using software, except physical)
○ Application Layer (HTTP,SMTP, DNS, FTP, POP3/4)
○ Transport Layer (TCP, UDP)
○ Network Layer (IP)
○ Data Link Layer (Ethernet)
TCP organised how data packets are communicated → it makes sure that each packet
has the information: source, destination, packet sequence, data, error check
two end-points must use the same TCP/IP protocol to communicate to each other
the software of each layer must be capable of receive and
transmit data in full-duplex to an adjacent layer
a protocol in an upper level is serviced by the protocols in
lower layers
logical peer-to-peer relationship → an application run on a
host can behave as though there is a direct communication
with an application running on a different host.
2. Protocols
TCP/IP Application Layer
● first layer in TCP/IP protocol suite; it contains all the programs that exchange data (web browsers, server software)
● in this layer, the user interacts with the computer and network; this layer sends files to transport layer
● allows applications to access the services used in other layers; it defines the protocols that any app uses to allow exchange of
data
● the application layer software packages the core data to be transmitted (email text, HTML tags and JavaScript code, …)
● some protocols used in this layer are: HTTP, POP3/4, SMTP, IMAP, DNS, FTP
● Hypertext Transfer Protocol (HTTP)
○ networking protocol behind the WWW; makes use of hyperlinks, it allows user on the web to exchange information
found on websites
○ features:
■ HTTP is used and hidden from view when a user accesses a web page
■ based on client-server relationship → HTTP protocol allows requests messages are sent out to web servers
■ transfers web pages/data from web servers to clients on the WWW using the Internet
■ HTTPS is used when data is encrypted → secure transmission
■ HTTP defines the format of the messages sent and received
■ process when a web page is requested:
● the user keys the URL → HTTP(s) transmits the request from application layer to transport layer (TCP)
● TCP creates data packets and sends them to destination port → DNS looks up the IP address of the web
server that stores the requested web page → the server sends back an acknowledgement →
communication established → server sends the HTML → browser interprets the code and shows the web.
3. Protocols
TCP/IP Application Layer
● File Transfer Protocol (FTP)
○ protocol used to copy a file from one host to another over a TCP/IP protocol (the Internet) network → FileZilla
○ web browsers can connect to FTP addresses such as ftp://username@ftpexample.gov
○ features:
■ used for downloading data using TCP/IP (transfers data between 2 computers using client-server relationship)
■ weak security → it does not have encryption (SSL) protocols
■ less straightforward if hosts have different OS with different file systems
■ uses: organise files from a web server; provision of software/files to be downloaded from a web server
● Email Protocols
○ based on client-mail server relationships (used in email applications such as Thunderbird); client → mail server →
mail server → client; protocols used are SMTP (Simple Mail Transfer Protocol), Post Office Protocol version 3/ version 4
(POP3/4) and Internet Message Access Protocol (IMAP)
○ SMTP → protocol used for sending an email across networks → push protocol (a client opens a connection to a server
and keeps the connection active all the time and the client uploads a new email to the server)
○ POP3/4 and IMAP → used for receiving emails across networks → pull protocols (the email client periodically connects
to a server, checks for new emails, download new emails, close the connection and repeats the process)
○ difference between POP3/4 and IMAP → POP3/4 does not keep the server and client in synchronisation, IMAP does.
○ SMTP, POP3/4 and IMAP have been superseded using web-based mail (Gmail, Hotmail) → SMTP is still used for transfer
between the email servers.
4. Protocols
TCP/IP Transport Layer
● second layer of TCP/IP protocol suite; it regulates and maintains the network connections (bidirectional connection between 2
hosts)
● in this layer, data is broken up into packets and sent to the Internet/network layer; it ensures data packets arrive in
sequence, without errors by swapping acknowledgements/retransmitting packets
● main protocol: Transmission Control Protocol (TCP)
○ creates sufficient packets for transmission, ensures the safe delivery of the message to the receiver
○ functions: split message into packets, include a sequence number for each packet, control the transfer of data,
reassemble packets at destination (reliable transmission); ensures any response is directed back to the application
protocol; TCP uses handshake processes
○ TCP does not know the IP address of the receiver
○ process: A sends one segment packet which includes synchronisation sequence bits to that segments will be received
in the correct order → B responds by sending its own segment containing an acknowledgement (acknowledgements
are used to identify and resend data packets if lost)
5. Protocols
TCP/IP Network/IP Layer
● function of network layer (IP protocol) → ensure correct routing over the Internet
● network layer identifies the recipient network and host; IP has two versions (IPv4, IPv6)
● it identifies and moves traffic across local segments, encapsulates IP packets into frames for transmission, maps IP addresses
to MAC (physical) addresses and ensures correct protocols are followed
● Functions: ensures correct routing of data packets across the network; responsible for protocols when communicating
between networks; takes a packet from the transport layer, adds its own header which will include IP addresses
(sender/receiver)
● the IP packet (datagram) is sent to the data-link layer where it assembles the datagrams into frames for transmission
6. Protocols
TCP/IP Data Link Layer
● the IP packet (datagram) is sent to the data-link layer and to another protocol depending on the type of network: wired
(Ethernet Protocol Suite); WLAN (Wi-Fi protocol); PAN (Bluetooth); WMANs (WiMax), P2P (Bittorrent)
● data-link layer assembles datagrams into frames → transmission begins on a hardware layer (IP has finished its duty)
● data-link layer receives packets from network layer and adds hardware addresses (MAC addresses)
Ethernet Protocol Suite
● Ethernet is the protocol used to control the movement of frames between computers/avoid simultaneous transmission
● Ethernet is local → it does not provide any communication with external devices
● Ethernet Data contains Destination (receiver’s MAC address), Source (sender’s MAC address), Ethernet type/length (if
frameLength <= 1539 then value = len(Ethernet_frame) else value = EthernetType; Actual message; Frame check sequence
(checksum to checking data integrity following transmission of the frame)
Bittorrent Protocol
● differences between client-server and Bittorrent
○ in client-server, a computer connects to the web server and downloads data directly
○ Bittorrent is a decentralized protocol used to share files by using peer-to-peer protocols
● a Bittorrent client (Bittorrent, Utorrent, Vuze, …) allows the user to join a swarm of hosts to upload/download files from each
other simultaneously without the need of a central server
7. Protocols
TCP/IP Data Link Layer
Bittorrent. Definitions
● swarm: computers connected to a single torrent
● peer: any client in the swarm
● seed: a machine processing some part of the data (a peer is a seed when it starts uploading the already downloaded content)
● tracker: a server that keeps track of which seeds and peers are in the swarm (tracks IP addresses to connect them)
● leecher: a peer that has a negative effect on the swarm (poor share ratio, + download, - upload)
● client: the program that enables P2P file sharing (uTorrent)
Bittorrent. Process
1. the user who wants to distribute a file over a P2P network converts the initial file into a torrent descriptor file (burning)
which includes: URL of tracker (server), name of directory where small pieces are stored, size of pieces,...)
2. the user distributes the torrent file (by email, web page, …)
3. a computer joins a Bittorrent swarm by loading a .torrent file into a client and instigates the download by connecting with the
tracker and then with the different seeds
4. the Bittorrent client downloads bits of the file in small pieces (the peer is a leecher at the moment)
5. once the Bittorrent client has some data, it uploads it to other clients in the swarm until the file has been downloaded
6. if the leecher remains connected even after they’ve downloaded the file, it is now a seeder (shares pieces of data)
7. in case of no seeders, the file cannot be downloaded because anybody has the complete file
8. Bittorrent rewards those clients who upload → clients with more upload bandwidth are rewarded rather than those who
uploads at a very low speed
8. Protocols
TCP/IP Data Link Layer
The main idea behind Bittorrent
● the main idea is the task of distributing the file is shared by a number of peers
● everyone downloading a torrent is also uploading the same torrent (this speeds up everyone’s download speed)
● Bittorrent clients never download files from the tracker (the tracker keeps track of the clients connected to the swarm)
● the nature of the receipt of pieces is not sequential
● the pieces requested by clients are small in size
● Bittorrent makes IP connections to many peer computers instead to traditional downloading makes a single IP connection to
the server
4 layers of TCP/IP
Protocols
Ethernet header
destination Ethernet Address, source Ethernet Address, ...
IP header
● the IP version
● source IP address
● destination IP address
● ‘time to live’ value, to stop a packet being continually passed from
one router to another without ever reaching its destination.
● checksum, to check the integrity of the header data
● total packet length, because of the data section and so the length
of the packet can be variable size.
TCP header
● source port and destination port fields that identify the end-points
of a connection
● sequence number field, that specified the number assigned to the
first byte of data in the current message
● acknowledgement number field
● data offset (header length) field that tells how many 32-bit words
are contained in the TCP header
● different fields such as checksum
9. Transmission modes. Circuit Switching and Packet Switching
Circuit Switching
● networking method to transfer data in which a path (circuit) is set up between devices in advance → it is used for the whole
communication → this is called dedicated communication channel (dedicated connection)
● although there are other possible paths to send data from A to B (or from B to A), all communications between A and B takes
over this circuit
● if A wants to communicate with B, it asks for the request to use the network and then the communication begins → if B wants
to communicate with D using the same cable, it will get a busy signal from the network
● classic example → telephone system
Packet Switching
● networking method in which data is sent as individual elements (packets/datagrams) over a variable path
● classic example → the Internet
● there are two strategies → Datagram and Virtual Connection (Virtual Circuit Switching)
● data is chopped into small pieces (datagrams containing source address, destination address, packet number and payload)
and sent to the network → packets are routed and combined as required until they arrive to the recipient → at the
recipient’s end, data is read from packets and re-assembled to form the original data
● data travel through network adapters, switches, routers, … → the route taken by each packet might vary → if there are a lot
of packets in the same route, packets are queued → varying times depending on the traffic load → if packets do not arrive,
re-routing is needed (sender transmits data again)
● simultaneous data transfer between A and C and B and C is possible
Circuit Switching and Packet Switching
● show understanding of circuit switching and where it is applicable
● show understanding of packet switching
● show understanding of the function of a router
● explain how packet switching is used to pass messages across a network, including the internet
Functions of a router
1. it acts as a gateway
2. it acts as a firewall
3. a router is used to join two different networks (with different protocols) such as WAN and LAN
4. a router can operate with different protocols
5. a router has a public IP address to connect to an external network and holds a list of local addresses
6. a router translates local addresses (private IP addresses) to the Internet (public IP addresses) and vice versa
Circuit Switching and Packet Switching. Comparison between processes
Circuit Switching Process between two computers A and B
1. the computer A sends a connection request to the computer B
2. the computer A sends a ready or busy signal
a. if busy, computer A waits a time and then re-sends the connection request to Computer B
b. if available (ready), Computer A sets up a path between nodes
3. the computer A sends the data
4. the computer B sends a receipt signal
5. the sender (computer A) signals computer B to deallocate resources (the communication can begin)
Packet Switching process when a client requests a web page from a web server
1.
2.
3.
4.
5.
the web page is split into several data packets (chunks)
each packet contains the destination IP address
when the packet arrives at the router of the sender, the router looks at the IP address of the receiver and decides where to send the
packet for the most efficient path
packets take different routers until arrives at the destination
when all of the chunks have arrived at the router of the destination, the computer reassembles them to rebuild the webpage.
Circuit Switching and Packet Switching
Circuit Switching
Packet Switching (Datagram)
dedicated path
no dedicated path
the path (dedicated circuit) is established for the entire conversation
the route is established for each packet
call setup delay
packet transmission delay
overload may block call setup
overload increases packet delay
fixed bandwidth
dynamic bandwidth
the full bandwidth is available for this connection
the bandwidth is shared between all of those devices that use the
same network
data transference is faster
data transference is slower
no overhead bits (non-necessary bits) after call setup
overhead bits in each packet
data is less likely to be lost
data can be lost
data is less likely to arrive out of order
data may arrive out of order (delay)
used in video-conferencing, real-time video
used in email sending and receiving, WWW, ...
Download