9.4. The Transmission Control Protocol - Internet Protocol (TCP IP)
9.4. The Transmission Control Protocol - Internet Protocol (TCP IP)
www.pmt.education
Specification:
4.9.4.1 TCP/IP:
Describe the role of the four layers of the TCP/IP stack (application,
transport, network, link)
Describe the role of sockets in the TCP/IP stack
Be familiar with the role of MAC (Media Access Control) addresses
Explain what the well-known ports and client ports are used for and the
differences between them.
www.pmt.education
4.9.4.3 IP address structure:
Know that an IP address is split into a network identifier part and a host
identifier part
4.9.4.5 IP standards:
Know that there are currently two standards of IP address, v4 and v6
Know why v6 was introduced
www.pmt.education
TCP / IP
TCP / IP stands for transmission control protocol / internet protocol. The protocol is used in
all parts of the Internet to enable different devices to communicate.
The protocol is formed from four distinct layers that form the TCP / IP stack. These layers
are application, transport, network, link and each is responsible for a seperate part of
communication over the Internet.
Layer Role
Application Selects and uses the correct protocol to transmit data. The layer
interacts with the user with application software like a web browser.
Let’s suppose we’re sending the following message over the Internet:
Network Provides the correct IP addresses for each packet’s source and
destination.
www.pmt.education
Link Controls physical connections between pieces of hardware in a network.
Adds MAC addresses to packets which it receives from the network
layer. MAC (which stands for media access control) addresses are
assigned to every device that can connect to a network by their
manufacturer and are unique to that device.
Firstly, the link layer removes MAC addresses from the packet. Next, the network layer
removes IP addresses before the transport layer uses the packet’s port number to
determine the correct application to send the packet to. The transport layer also uses the
packet’s sequence number to ensure that it is in the correct position relative to other
packets in the same transmission.
Finally, the application layer receives the packets and displays the information to the user
accordingly.
Socket addresses
When an IP address is combined with a port number, a socket address is formed. These
are formed from an IP address, followed by a colon, followed by the port number in use.
A socket address identifies which of the applications on the recipient device a packet
should be sent to.
www.pmt.education
Well-known ports
The table below lists some well-known ports, their port number and their purpose.
www.pmt.education
The structure of IP addresses
An IP address is split into two parts: a network identifier and a host identifier. Each of the
computers in a network shares the same network identifier but has its own host identifier.
192.168.3.24
IP Address of device
11000000.10101000.00000011.00011000
IP Address of device (binary)
255.255.255.0
Subnet mask
11111111.11111111.11111111.00000000
Subnet mask (binary)
11000000.10101000.00000011.00000000
IP address ANDsubnet mask
192.168.3.0
Network identifier (IP address ANDsubnet mask, in decimal)
As it happens, 255.255.255.0 is a fairly common subnet mask that is easy to use in
examples. However, the same procedure can be applied to any subnet mask.
The more bits that are assigned to the network identifier of an IP address, the more
different subnets a network can have. In the same way, the more bits that are assigned to
the host identifier, the more different devices can be connected to each subnet
simultaneously.
www.pmt.education
IP address standards
There are two types of IP address in common use: versions four and six (IPv4 and IPv6).
IPv4
IPv4 addresses are dotted quad numbers, meaning that they consist of four parts that are
separated by dots. Each of the four parts of an IPv4 address is assigned one byte (eight
bits) allowing for numbers from 0to 255to be represented.
192.168.34.7
This allows for a total of slightly over 4 billion (2564) unique IPv4 addresses. That may
sound like a lot, but IPv4 addresses are in short supply. The number of devices on the
Internet that require a routable IP address is increasing so rapidly that a new version of IP
address had to be created. This was IPv6.
IPv6
IPv6 addresses are formed of eight blocks separated by colons. Each block contains four
hexadecimal characters (a-z and 0
-9
).
2071:0eb8:85a3:8a2f:0000:0000:0370:7264
IPv6 addresses use 128 bits which, compared to IPv4’s use of 32, allows for far more (in
the order of 1037) unique permutations.
Instead, each home or business that requires internet access has a small number of public
IP addresses. Most homes have just one public IP address while some businesses will
have multiple addresses.
Routable IP addresses are globally unique whereas millions of devices can have the same
non-routable IP address, provided they are not on the same network. Global authorities
are responsible for assigning routable IP addresses which ensures that the same address
is never issued twice.
www.pmt.education
Dynamic host configuration protocol (DHCP)
The number of available private IP addresses within a private network is limited. Assigning
each device on a network its own private IP address would not be sensible, as that device
may leave and never join again, resulting in a wasted IP address.
Instead, DHCP is used to assign IP addresses to devices as they join a network. DHCP
uses a pool of available IP addresses to allocate IP addresses to new devices for the
duration of their session. Once a device leaves the network, the IP address that the device
was using is returned to the pool for allocation to a new device.
If a device on the network sent a packet to the server, the server couldn’t respond to the
computer directly because the computer’s IP address is non-routable - not globally unique.
www.pmt.education
Port forwarding
Port forwarding is used when a client needs to communicate with a server that is
connected to a private network.
The private network’s router then forwards the packets to the server using NAT.
In a network that uses the client server model, clients send request messages to servers,
which reply to the clients with response messages. These messages may contain
requested information, a confirmation that a requested action has been completed, or a
message explaining why the requested action hasn’t been completed.
There are a number of different types of servers, each of which specialise in a certain task.
For example: file servers, database servers and email servers.
APIs
An API (application programming interface) is a name given to a set of protocols relating to
how different applications communicate with each other. They define how interaction
between the applications should be carried out, allowing applications to make use of other
applications.
The connection created by the websocket protocol is full-duplex, meaning that data can be
transmitted in both directions at the same time.
The websocket protocol, which allows for fast transmission of data by reducing the size of
packet headers, is used in video streaming, online games and instant messaging.
www.pmt.education
Web CRUD Applications and REST
CRUD
CRUD is an acronym for create, retrieve, update, delete; four commands that can be used
to query online databases. Each of the four CRUD commands has a SQL equivalent.
CRUD SQL
Create INSERT
Retrieve SELECT
Update UPDATE
Delete DELETE
REST
An acronym for representational state transfer, REST is a design methodology for online
database applications that are queried with a web browser.
REST uses the four HTTP request methods POST, GET, PUT and DELETE to query
databases.
HTTP SQL
POST INSERT
GET SELECT
PUT UPDATE
DELETE DELETE
www.pmt.education
XML and JSON
Database servers deliver responses to queries using either XML or JSON. XML stands for
extensible markup language and does the same job as JavaScript object notation
(JSON).
XML JSON
{
"Department": {
<Department> "Subject": [
<Subject> {
<Name>Physics</Name> "Name": "Physics",
<Board>Edexcel</Board> "Board": "Edexcel"
</Subject> },
<Subject> {
<Name>Maths</Name> "Name": "Maths",
<Board>AQA</Board> "Board": "AQA"
</Subject> }
</Department> ]
}
}
The table above shows the same information represented as both XML and JSON. As the
table shows, JSON is more compact, easier to read, easier to create and faster for
computers to process than XML. However, XML is sometimes seen to be more flexible
than JSON.
www.pmt.education
Thin- and thick-client computing
Thin-client networks
In thin-client networks, the majority of the network’s processing power belongs to servers
which provide services and resources including storage and processing.
It’s easy to add new clients to thin-client networks and the clients themselves are
inexpensive machines. Thin-client networks also allow for greater centralised control of the
network as software updates and security can be managed from the server.
However, thin-client networks require a powerful server which is expensive and requires
expertise to set up and maintain.
Thick-client networks
In a thick-client network, the clients are powerful enough to provide their own processing
power and storage. This independence eliminates the requirement for a server, although it
is possible for thick-client networks can make use of a server.
Thick-client networks require more powerful clients than their thin-client counterparts,
making the network expensive to set up. However, the cost and expertise required in
setting up and maintaining an expensive server is done away with.
Thick-client networks are harder to maintain because there is no facility to issue updates
and manage security from a central server.
Compared to thin-client networks which suffer from high volumes of traffic communicating
between clients and the server, thick-client networks boast much quieter communication
channels which reduces the likelihood of data collisions.
www.pmt.education