0% found this document useful (0 votes)
9 views44 pages

Lec 1 Network Programming

The document provides an overview of computer networking, including its purpose, types of networks (LAN, WAN, MAN, PAN), and essential networking terminologies such as hosts, IP addresses, ports, and protocols (TCP, UDP). It also covers the OSI model, socket communication, and the role of proxies in managing network traffic and security. Additionally, it discusses application layer protocols like HTTP, FTP, and SMTP, highlighting their functions in web communication.

Uploaded by

keyeyod746
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views44 pages

Lec 1 Network Programming

The document provides an overview of computer networking, including its purpose, types of networks (LAN, WAN, MAN, PAN), and essential networking terminologies such as hosts, IP addresses, ports, and protocols (TCP, UDP). It also covers the OSI model, socket communication, and the role of proxies in managing network traffic and security. Additionally, it discusses application layer protocols like HTTP, FTP, and SMTP, highlighting their functions in web communication.

Uploaded by

keyeyod746
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

What is Networking?

The main goal of computer networking is to


study and analyze the communication process
among various computing devices or computer
systems that are linked, or networked together to
exchange information and share resources.
3

Types of Network
1. LAN (Local Area Network)
Used to serve a small number of people located in a
small geographical space It's more of a peer to peer
connection.
4

Types of Network
2. WAN (Wide Area Network)
This network type covers more
area than LAN as they allow
connectivity across large
geographical Area. It basically
connects many LANs together
to reach beyond just peer to
peer sharing.
5

Types of Network
3. MAN (Metropolitan Area Network)v

MAN is a computer network

that interconnects users with

computer resources in a

geographic area or region

larger than that covered by a

LAN but smaller than the area

covered by a WAN
6

Types of Network
3. PAN (Personal Area Network)

A personal area network (PAN) is


a computer network used for data
transmission among a set of
devices such as computers,
telephones, tablets and personal
digital assistants.
7

Networking Terminologies
8

Host

Devices connected to the Internet are called hosts

Most hosts are computers, but hosts also include routers,


printers, fax machines, PDAs, Tablets, etc.
9

IP Addresses

❑ The IP address is a numerical label assigned to each device


(host) connected to a computer network that uses the Internet
Protocol for communication.

❑ This is written in dotted quad format like [Link] where each


byte is an unsigned integer between 0 and 255.
Domain Name System (DNS)

o Numeric addresses (IP address) are mapped to names like


"[Link]" or "[Link]" by DNS.

o Each site runs domain name server software that translates


names to IP addresses and vice versa
11

Ports

❑ Generally, each host has only one Internet address (IP adress)

This address is subdivided into 65,536 ports.

❑ Ports are logical address that allow one host to communicate


simultaneously with many other hosts.

❑ Port number is used to identify an application/services which you


want to talk to on your system.
12

Ports

Some common ports are


•22: Secure Shell(SSH)
•23: Telnet Remote Login Service
•25: Simple Mail Transfer Protocol(SMTP)
•53: Domain Name System(DNS) Service
•80: Hyper Text Transfer Protocol(HTTP) used in the World Wide
Web
❑ You identify a host uniquely (globally) by its IP address. So if I
ever wanted to access your laptop via telnet then I'd use the IP
address given to you by your ISP and the port 23
13

firewall

❑ A firewall is a network security device that monitors


incoming and outgoing network traffic and decides whether
to allow or block specific traffic based on a defined set of
security rules.

❑ The most common firewall types based on methods of


operation are: Packet-filtering firewalls. Proxy firewalls.
14

Internet Protocol

These are the set of procedures or rules which control the


flow of data, format of data over the internet.

The two major protocols over the internet:

o User Datagram Protocol (UDP)


o Transmission Control Protocol (TCP)
15

User Datagram Protocol (UDP)

o UDP is a connectionless protocol in which data is sent over the


internet as datagrams.

o Unreliable: When a UDP message is sent, there is no way to


know if it will reach its destination or not; there is no concept of
acknowledgment, retransmission, or timeout (as in TCP).

o Not ordered: If two messages are sent to the same recipient,


the order in which they arrive cannot be predicted.

o Lightweight : UDP doesn’t require control packets


16

Transmission Control Protocol (TCP)

o TCP is a connection oriented protocol in which data is


sent over the internet as packets.
o In TCP there is a concept of handshake.

It's a way to ensure that the connection has been


established between interested hosts and therefore
data transfer can be initiated.
17

properties of TCP

1. Reliable: TCP manages message acknowledgment,

retransmission and timeout.

Multiple attempts to deliver the message are made.


If it gets lost along the way, the server will re-request
the lost part.

2. Ordered: The messages are delivered in the correct order


18

3. Heavyweight: TCP requires three packets to set up a

socket connection, before any user data can be sent.

The three packets are: SYN, SYN+ACK and ACK


19

Elements of C-S Computing

a client, a server, and network

Client
Server
Network

Client machine
Server machine
20

Networking Basics
 TCP/IP Stack
 Applications Layer
 Standard apps
 HTTP
 FTP Application
 Telnet
(http,ftp,telnet,…)
 User apps
 Transport Layer Transport
 TCP (TCP, UDP,..)
 UDP
 Programming Interface: Network
 Sockets (IP,..)
 Network Layer Link
 IP
 Link Layer (device driver,..)
 Device drivers
21

Sockets

o A socket is one endpoint of a two-way communication link


between two programs running on the network.
o A socket is bound to a port number so that the TCP layer
can identify the application that data is destined to be sent
to.
o An endpoint is a combination of an IP address and a port
number. Every TCP connection can be uniquely identified
by its two endpoints. That way you can have multiple
connections between your host and the server.
22

Sockets

o The main difference between socket and port is


that the socket is the interface of sending and
receiving data on a specific port while the port is a
numerical value assigned to a specific process or
an application in the device. ... In brief, a socket is
the communication path to a port.
23

Socket Communication

A server (program) runs on a specific computer


and has a socket that is bound to a specific port.
The server waits and listens to the socket for a
client to make a connection request.

Connection request
port

server
Client
24

Socket Communication
 Ifeverything goes well, the server accepts
the connection. Upon acceptance, the
server gets a new socket bounds to a
different port. It needs a new socket
(consequently a different port number) so
that it can continue to listen to the original
socket for connection requests while
serving the connected client.
port

port
server Client
port Connection
Internet Connections
 Clients
and servers communicate by sending
streams of bytes over connections
 Connections are point-to-point, full-duplex (2-way
communication), and reliable

Client socket address Server socket address


[Link]:51213 [Link]:80

Server
Client
Connection socket pair (port 80)
([Link]:51213, [Link]:80)
Client host address Server host address
[Link] [Link]
Note: 51213 is an
ephemeral port allocated Note: 80 is a well-known port
by the kernel associated with Web servers
26

OSI Model Layers


Layer - 7 Application
Upper Layer
Layer - 6 Presentation or
Software Layer
Layer - 5 Session

Layer - 4 Transport

Layer - 3 Network
Lower Layer
Layer - 2 Data Link or
Hardware Layer
Layer - 1 Physical
27

Application Layer

Application
Application Application Layer is responsible for
providing Networking Services to the user.
Presentation
It is also known as Desktop Layer.
Session Identification of Services is done using Port
Numbers.
Transport
Ports are Entry and Exit Points to the Layer
Network
Total No. Ports 0 – 65535
Data Link
Reserved Ports 0 – 1023
Open Client Ports 1024 – 65535
Physical
Data flow from Application Layer
Examples of Networking Services
Application Data

80 21 25 53 67 69

Presentation

Session

Transport

Network

Data Link

Physical
29

Examples of Networking Services

Service Port No.

HTTP 80

FTP 21

SMTP 25

TELNET 23

TFTP 69
30

Application Layer Protocols

1. HTTP: Hyper Text Transfer Protocol


2. Telnet: Telnet is an application protocol. ...
3. FTP: File Transfer Protocol.
4. TFTP: Trivial File Transfer Protocol
5. SMTP: Simple Mail Transfer Protocol
6. SNMP: Simple Network Management Protocol
7. DNS: Domain Network System
8. DHCP: Dynamic Host Configuration Protocol
HTTP Protocol
HTTP Protocol

 The Hypertext Transfer Protocol (HTTP) is an

application-level protocol.

Version

HTTP version 1.0 is a stateless protocol

HTTP 1.1 is stateful protocol


HTTP Protocol

❑ HTTP is the protocol that supports communication between


web browsers and web servers.

❑ A “Web Server” is a HTTP server.

❑ Most clients/servers today speak version 1.1.

• The RFC states that the HTTP protocol generally takes place
over a TCP connection,
HTTP-based systems

❑ HTTP is a client-server protocol: requests are sent by one


entity, the user-agent (or a proxy on behalf of it).

❑ The user-agent, in the context of web communication, refers to


a software application or tool that acts on behalf of the user
when interacting with web servers. While it's true that web
browsers are a common and primary example of user-agents,
it's essential to clarify that the term is not limited to browsers
alone. The user-agent header in HTTP requests identifies the
client making the request, and this can include various tools or
applications.
Components of HTTP-based systems

❑ The browser is always the entity initiating the request.

❑ To display a Web page, the browser sends an original request


to fetch the HTML document that represents the page.

❑ Each individual request is sent to a server, which handles it and


provides an answer called the response.

❑ Between the client and the server there are numerous entities,
collectively called proxies, which perform different operations
and act as gateways or caches.
Client: the user-agent

❑ A Web page is a hypertext document. This means some parts


of the displayed content are links, which can be activated
(usually by a click of the mouse) to fetch a new Web page,
allowing the user to direct their user-agent and navigate
through the Web.

❑ The browser translates these directions into HTTP requests,


and further interprets the HTTP responses to present the user
with a clear response.
The Web server

❑ On the opposite side of the communication channel is the


server, which serves the document as requested by the client.

❑ A server appears as only a single machine virtually; but it may


actually be a collection of servers sharing the load (load
balancing), or a complex piece of software interrogating other
computers (like cache, a DB server, or e-commerce servers),
totally or partially generating the document on demand.
Proxies

❑ A proxy server acts as an intermediary between client devices


(such as computers or smartphones) and other servers (typically
web servers). Here are the key roles of a proxy server:

▪ Content Filtering:

Proxy servers can be configured to filter content based on


predefined rules. This is commonly used to restrict access to certain
websites or content categories, enhancing security and enforcing
network policies.

The rules are typically set by administrators to enforce security


policies, manage access, and optimize network usage
Proxies

▪ Access Control:

By serving as a gateway, proxy servers can control and manage


access to specific resources or services. Access control policies can
be applied based on IP addresses, user credentials, or other criteria.

▪ Anonymity and Privacy:

Proxy servers can provide a level of anonymity for users by masking


their IP addresses. This can be useful for protecting user privacy or
bypassing geolocation restrictions.
Proxies

▪ Caching:

Proxies cache frequently requested web content locally. When a user


requests a resource, the proxy checks if it has a local copy. If
available, the proxy serves the cached content, reducing latency and
bandwidth usage.

▪ Load Balancing:

In a network with multiple servers, a proxy can distribute incoming


requests across these servers to balance the load. This helps
optimize resource utilization and ensures that no single server is
overwhelmed with traffic.
Proxies

▪ Security:

Proxy servers can enhance security by acting as a barrier between


the internal network and external servers. They can inspect and filter
incoming and outgoing traffic, blocking malicious content or
unauthorized access attempts.

▪ Logging and Monitoring:

Proxies log details about network traffic, providing administrators


with valuable insights into user activities. This information can include
accessed URLs, bandwidth usage, and more, aiding in
troubleshooting and security analysis.
Proxies
▪ SSL Inspection:

Some proxies have the capability to inspect and decrypt Secure


Sockets Layer (SSL) or Transport Layer Security (TLS) encrypted
traffic for security analysis. This is crucial for detecting and preventing
threats hidden in encrypted connections.

▪ Bandwidth Control:

Proxy servers can control and limit the amount of bandwidth


allocated to specific users or applications. This helps prevent network
congestion and ensures a fair distribution of resources.
Proxies
▪ Protocol Filtering:

Proxies can filter and control specific network protocols, such as


HTTP, HTTPS, FTP, and more. This allows administrators to enforce
usage policies and ensure secure and efficient network
communication.

▪ Content Modification:

❑ Proxies can modify content in transit, such as compressing


images or scripts to reduce data transfer time. This is known as
content optimization and can improve overall performance.


44

Thank You !

You might also like