Networkprogramming
Networkprogramming
Assignment one
in
network programming
Data Link Layer (Layer 2): This layer is responsible for providing error-free transfer of data frames
between devices on the same network, using protocols such as Ethernet or Wi-Fi.
Network Layer (Layer 3): This layer is responsible for the logical addressing and routing of data
packets between different networks. It includes protocols such as IP and ARP.
Transport Layer (Layer 4): This layer provides reliable end-to-end data transport services, including
error recovery and flow control. It includes protocols such as TCP and UDP.
Application Layer (Layer 5): This layer provides various services to end-users, including file sharing,
email, and web browsing. It includes protocols such as HTTP, FTP, and DNS.
These five layers are common to both the TCP/IP reference model and the OSI model, and they are
essential for designing a smart Ethernet LAN. However, the specific protocols used within each layer
may differ depending on the requirements of the network and the devices being used.
In summary, to design a smart Ethernet LAN using the TCP/IP reference model or the OSI model, we
need to consider the physical, data link, only of the model, and select the appropriate protocols for
each layer based on the requirements of the network.
• Line Configuration: defines the way how two or more devices can be connected physically
• Data Transmission: defines the transmission mode whether it is simplex, half-duplex or full-duplex
mode between the devices on the network
• Topology: defines the way how network devices are arranged
• Signals: determines the type of the signal used for transmitting the information.
Data_Link:
Protocol:
services:
• Framing:
• Flow Control: is the main functionality of the Data-link layer. It is the technique through which the
constant data rate is maintained on both the sides so that no data get corrupted. It ensures that the
transmitting station such as a server with higher processing speed does not exceed the receiving
station, with lower processing speed.
• Error Control:
• Access Control
Network Layer:
Protocol:
• that manages device addressing, tracks the location of devices on the network.
• It determines the best path to move data from source to the destination based on the network conditions,
the priority of service, and other factors.
• responsible for routing and forwarding the packets.
• The protocols used to route the network traffic are known as Network layer protocols. Examples of
protocols are IP and Ipv6.
services:
• Protocol:
• Transmission Control Protocol
o It is a standard protocol that allows the systems to communicate over the internet.
o It establishes and maintains a connection between hosts.
o When data is sent over the TCP connection, then the TCP protocol divides the data into smaller
units known as segments. Each segment travels over the internet using multiple routes, and they
arrive in different orders at the destination. The transmission control protocol reorders the
packets in the correct order at the receiving end.
• User Datagram Protocol
o User Datagram Protocol is a transport layer protocol.
o It is an unreliable transport protocol as in this case receiver does not send any acknowledgment
when the packet is received, the sender does not wait for any acknowledgment. Therefore, this
makes a protocol unreliable.
services:
• Service-point addressing
• Segmentation and reassembly
• Connection control:
• Flow control:
• Error control:
--Interfaces:
Between the server and switch: fa0
Between the server and PCs: fa0/1, fa0/2 , fa0/3 , fa0/4
In the TCP/IP model, each layer has its own required interfaces for communication between devices on
the network. Interfaces are connection points between devices on a network and are responsible for
managing the flow of data. The required interfaces in each layer of the TCP/IP model are as follows:
Network Interface Layer: At this layer, the required interface is the physical interface that connects a
device to the network. This could be an Ethernet port, Wi-Fi adapter, or other physical connection. The
interface at this layer is responsible for transmitting and receiving data between the device and the
network.
Internet Layer: The required interface at this layer is the IP interface, which is responsible for managing
the IP address of the device. The IP interface handles tasks such as packet forwarding and routing, and
it ensures that data is delivered to the correct destination on the network.
Transport Layer: At this layer, the required interface is the socket interface, which is responsible for
managing the flow of data between applications. The socket interface ensures that data is delivered to
the correct application on the correct device, based on the combination of the source and destination
IP addresses and port numbers.
Application Layer: At this layer, the required interface is the application interface, which is responsible
for managing the flow of data between the application and the network. The application interface
provides a way for the application to send and receive data, and it may use various protocols such as
HTTP or FTP.
--Sockets:
In the TCP/IP model, each layer has its own required socket for communication between devices on the
network. Sockets are endpoints that allow data to be sent and received over a network. The required
sockets in each layer of the TCP/IP model are as follows:
Network Interface Layer: At this layer, the required socket is the physical interface that connects a
device to the network. This could be an Ethernet port, Wi-Fi adapter, or other physical connection.
Internet Layer: The required socket at this layer is the Internet Protocol (IP) address, which uniquely
identifies a device on the network. The IP address is used to route data packets between different
networks.
Transport Layer: At this layer, the required socket is a combination of the source and destination IP
addresses and the port numbers of the application that is sending or receiving data. This combination
is known as a socket address, and it is used to ensure that data is delivered to the correct application
on the correct device.
Application Layer: At this layer, the required socket is the socket used by the application to send and
receive data. Applications use a variety of sockets, depending on the protocol they are using. For
example, HTTP uses port 80, while FTP uses port 21.
Critically analyze the layers for OSI and TCP/IP reference models. Examine the changes, if a
new clients PCs have been added to the Network with different hardware configurations and
operating systems.
One key difference between the two models is the number of layers. The OSI model has more layers than the
TCP/IP model, which makes it more granular and detailed in terms of the functions and responsibilities of each
layer. However, the TCP/IP model is simpler and more widely used in practical network applications.
If a new client PC with different hardware configurations and operating systems is added to the network, the
layers involved in communication between the devices will depend on the protocols and technologies being
used. The new PC will need to have the appropriate drivers and software to communicate with the network,
and it will need to adhere to the communication protocols used by the network.
In terms of the OSI and TCP/IP models, the addition of a new client PC may require modifications to several
layers in the network stack. For example, at the physical layer, the new PC may have a different type of
network interface (such as Wi-Fi instead of Ethernet), which could require changes to the network
infrastructure.
At the transport layer, the new PC may need to use a different protocol (such as UDP instead of TCP), which
could affect how data is transmitted and managed between devices. Similarly, at the application layer, the
new PC may require different software or configurations to communicate with the network.
In summary, the addition of a new client PC to a network with different hardware configurations and
operating systems may require modifications to multiple layers of the OSI and TCP/IP models. The specific
changes will depend on the protocols and technologies being used in the network and the requirements of the
new PC.
5. Present a technical report to describe layers and services for that network application. In
this case, discuss the benefits, types, and GPU specifications of Graphics cards, then give some
real-world application examples.
Introduction
In this technical report, we will discuss the layers and services required for a LAN network application. We will
also provide an overview of Graphics Processing Units (GPUs) including their types, specifications, and
benefits, along with some real-world application examples.
The OSI model consists of seven layers, while the TCP/IP model has four layers. The seven layers of the OSI
model are as follows:
Physical layer: This layer defines the physical aspects of network communication, such as cables, connectors,
and signal transmission.
Data link layer: This layer is responsible for the reliable transmission of data between devices.
Network layer: This layer manages the routing of data between devices on different networks.
Transport layer: This layer provides reliable communication between devices by establishing a connection-
oriented session.
Session layer: This layer manages the communication session between two devices, including the start, end,
and synchronization of the session.
Presentation layer: This layer translates the data format into a form that the application layer can understand.
Application layer: This layer provides services to the user, such as email, file transfer, and web browsing.
The TCP/IP model has four layers:
Network Interface layer: This layer provides the physical connection to the network, such as Ethernet or Wi-Fi.
Internet layer: This layer manages the routing of data packets over the internet.
Transport layer: This layer provides end-to-end communication between devices and includes protocols such
as TCP and UDP.
Application layer: This layer provides services to the user, such as email, file transfer, and web browsing.
Benefits of a LAN Network Application
The benefits of a LAN network application include:
Cost-effective: A LAN network application is a cost-effective way to connect devices in a limited geographic
area.
Efficient communication: A LAN network application provides efficient communication between devices,
allowing users to share resources and collaborate.
Improved productivity: A LAN network application can improve productivity by providing users with access to
shared resources such as printers, scanners, and files.
Types and Specifications of GPUs
A Graphics Processing Unit (GPU) is a specialized processor that is designed to handle complex graphics and
image processing tasks. There are two main types of GPUs: integrated and discrete.
Integrated GPUs are built into the CPU and are suitable for basic graphics tasks such as web browsing and
office applications. Discrete GPUs are separate components that are designed for high-performance graphics
tasks such as gaming and video editing.
Clock speed: The clock speed determines how quickly the GPU can perform calculations.
Memory bandwidth: The memory bandwidth determines how quickly the GPU can access data in memory.
VRAM (Video Random Access Memory): The VRAM determines how much memory the GPU has available to
store textures and other graphics-related data.
Real-World Application Examples
GPUs are used in a variety of applications such as:
Gaming: GPUs are used in gaming to provide realistic graphics and fast frame rates.
Video editing: GPUs are used in video editing to provide fast rendering times and smooth playback.
Machine learning: GPUs are used in machine learning to provide fast training times for neural networks.
Conclusion
In this technical report, we discussed the layers and services required for a LAN network application. We also
provided an overview of Graphics Processing Units (GPU
Task 2
From your exploration of Socket Modules and Methods for a Client/Server communications,
critically compare and contrast the addressing of Internet Protocol version 4 (IPv4) and
Internet Protocol Version 6 (IPv6) in socket Module and give some real-world examples.
IPv4 addresses are 32 bits long and represented as four octets separated by dots (e.g. 192.0.2.1).
In the socket module, IPv4 addresses are typically represented as strings.
The AF_INET address family is used for IPv4 addresses.
The socket() function is used to create a new socket object, and the bind() method is used to associate the socket with
an IPv4 address and port number.
Example: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) creates a new IPv4 socket object.
IPv6 addressing in Socket Module:
IPv6 addresses are 128 bits long and represented as eight groups of four hexadecimal digits separated by colons (e.g.
2001:0db8:85a3:0000:0000:8a2e:0370:7334).
In the socket module, IPv6 addresses are typically represented as strings.
The AF_INET6 address family is used for IPv6 addresses.
The socket() function is used to create a new socket object, and the bind() method is used to associate the socket with
an IPv6 address and port number.
Example: s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) creates a new IPv6 socket object.
Now, let's compare and contrast IPv4 and IPv6 addressing in socket module:
Address length:
IPv4 addresses are 32 bits long, while IPv6 addresses are 128 bits long. This means that IPv6 addresses can
accommodate a much larger address space than IPv4 addresses.
Address representation:
IPv4 addresses are represented as four octets separated by dots, while IPv6 addresses are represented as eight groups
of four hexadecimal digits separated by colons. IPv6 addresses are more difficult for humans to read and write than IPv4
addresses.
Address families:
IPv4 addresses use the AF_INET address family, while IPv6 addresses use the AF_INET6 address family. This means that
IPv4 and IPv6 addresses are treated differently in the socket module.
Compatibility:
IPv4 is the most widely used IP version today, but the transition to IPv6 is happening gradually. IPv6 was designed to
address the limitations of IPv4 and provide a larger address space. In order to facilitate the transition to IPv6, many
operating systems and applications are now designed to support both IPv4 and IPv6 addressing.
Real-world Examples:
A website running on an IPv4 address might be accessed via the URL http://192.0.2.1/, where 192.0.2.1 is the IPv4
address.
A website running on an IPv6 address might be accessed via the URL
http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]/, where 2001:0db8:85a3:0000:0000:8a2e:0370:7334 is the IPv6
address enclosed in square brackets.
2. Produce a Client/Server programs using Python programming language for UDP protocols to
with THREE different Socket Module parameters and port numbers.
First
Second program that use server to give the client current data
Third program for program server give client specific ip address
Client side
5. Critically analyse the main communications parameters and program flow diagram in
Client/Server programs for the developed program, and give a real-world application example
IP Address and Port Number: The server needs to bind to a specific IP address and port
number in order to listen for incoming connections. The client needs to know the IP address
and port number to connect to the server.
Protocol: The server and client need to use the same protocol, such as TCP or UDP, in order to
communicate effectively.
Data Format: The server and client need to agree on the format of the data being sent and
received. This includes the size of the data packets and the encoding used.
Error Handling: Both the server and client need to handle errors that may occur during the
communication process, such as network failures or unexpected data.
As for the program flow diagram, a typical client/server program follows the following steps:
The server sets up a socket and binds to a specific IP address and port number.
The server listens for incoming connections from clients.
When a client connects, the server accepts the connection and creates a new socket for that
client.
The server sends data to the client or receives data from the client using the new socket.
The client sets up a socket and connects to the server using the server's IP address and port
number.
The client sends data to the server or receives data from the server using the socket.
As for a real-world application example, client/server programs are used in many different
industries and applications, including:
Web Servers: A web server is a program that serves web pages to clients. When a client sends
a request for a web page, the server sends the page back to the client.
Online Gaming: Many online games use client/server architecture to allow multiple players to
interact with each other in real time.
Chat Applications: Chat applications use client/server architecture to allow users to send
messages to each other.
File Sharing: Peer-to-peer file sharing applications can use client/server architecture to allow
users to search for and download files from other users.