Google Class Code: S52budw

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Google Class Code

s52budw

Unit Code: L/615/1680 (BTEC 2nd Year)

Instructor: Er. Saurabh Karn


L01: Explore the concepts of servers, clients, and processes &
the differences between PPID and PID

 Introduction to the structure of Open Systems Interconnection model (OSI


model) and the operation of Transmission Control Protocol/Internet Protocol
(TCP/IP).

 Basic concepts of client, server, process.

 Introduction to the concept and function of Sockets Interface.

 The communication process between servers and clients (e.g. echo server
process).

 Measures to ensure server security.

©spickmlk 2
©spickmlk 3
DNS - Domain Name System

Alphabetic name IP Address


remember by human

 It is an internet service that translates domain names into IP addresses.


 It is application-layer protocol. DNS service must translate the domain name into
the corresponding IP address.
 In DNS system, If one DNS server doesn't know how to translate a particular
domain name, it asks another one, and so on, until the correct IP address is
returned.
DNS - Example
L01: Explore the concepts of servers, clients, and processes &
the differences between PPID and PID

 Introduction to the structure of Open Systems Interconnection model (OSI


model) and the operation of Transmission Control Protocol/Internet Protocol
(TCP/IP).

 Basic concepts of client, server, process.

 Introduction to the concept and function of Sockets Interface.

 The communication process between servers and clients (e.g. echo server
process).

 Measures to ensure server security.

©spickmlk 6
Introduction to the concept and
function of Sockets Interface.

©spickmlk 7
Port
 Analogy:
 Ram send a parcel from Dhangadhi to Shyam who is in Kathmandu (Sun city Apartment).

 Derivation from analogy


 Reaching Kathmandu = Reaching our Network (IP Address)
 Reaching Sun City = Reaching the Host (MAC Address)
 Reaching to Shyam in Block-B 3rd Floor = Reaching the right process (Port Address)

©spickmlk 8
Port Number or Port Address
 In a node there will be various running processes.
 Data which are being sent/received must reach the right process. So each process in
a node is uniquely identified using port numbers.
 Port = Communication endpoint.
 Fixed port number and dynamic port number (0 – 65535)

©spickmlk 9
Port Number or Port Address
 So, before sending the data any node must:
 Attach source IP and destination IP.
 Attach source MAC and destination MAC.
 Attach source Port number and destination Port number.

©spickmlk 10
How to see Port number

©spickmlk 11
Sockets
 A process sends messages into, and receives messages from; the network through a
software interface called a socket.
 A process is similar to a house and its socket is similar to its door.
 Sending process passes message out door.
 Sending process relies on transport infrastructure on other side of door to deliver message
to socket at receiving process.

Process
application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
Socket physical physical
Sockets
 A socket is defined as an endpoint for communication.
 A pair of process communicating over a network employ a pair of sockets-one for
each process.
 A socket is identified by an IP address concatenated with a port number.
 The server waits for incoming client request by listening to a specified port.
 Once a request is received, the server accepts a connection from the client socket to
complete the connection.
 Server implementing specific services (such as telnet, ftp and http) listen to well-known
ports.
 A telnet listen to port 23, ftp listens to port 21, and web or http server listens to port 80

 All ports below 1024 are considered well known; we can use them to implement
standard services.

©spickmlk 13
Communication using Sockets

 The packets travelling


between the hosts are
delivered to the
appropriate process
based on the destination
port number.

 When a client process


initiates a request for
connection, it is assigned
a port by host computer.
(this port no is some
arbitrary number greater
than 1024)
©spickmlk 14
Socket Programming
 Socket is interface between application and network.
 An application creates a socket.
 Two type of socket:
1. TCP Socket – Reliable Transmission
2. UDP Socket – Unreliable Transmission

 Once configured the application can pass data to the socket for transmission and
receive data from the socket (transmitted through the network by some other host).

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
physical physical
Need of Socket Programming
“To build any network application”

 WWW (Mozilla, IE, etc..)


 FTP (WS FTP , etc..)
 P2P (LimeWire, BitComet , etc..)

©spickmlk 16
Socket Programming
“Telephone Analogy”
A telephone call over a “telephony network” works as follows:

 Both parties have a telephone installed.


 A phone number is assigned to each telephone.
 Turn on ringer to listen for a caller.
 Caller lifts telephone and dials a number.
 Telephone rings and the receiver of the call picks it up.
 Both Parties talk and exchange data.
 After conversation is over they hang up the phone.
Dissecting the Analogy
A network application works as follows:

 An endpoint (telephone) for communication is created on both ends.


 An address (phone no) is assigned to both ends to distinguish them from
the rest of the network.
 One of the endpoints (caller) initiate a connection to the other.
 The other end (receiver) point waits for the communication to start.
 Once a connection has been made, data is exchanged (talk).
 Once data has been exchanged the endpoints are closed (hang up).
In the world of sockets……
“Various Calls”

 Socket() – Endpoint for communication


 Bind() - Assign a unique telephone number.
 Listen() – Wait for a caller.
 Connect() - Dial a number.
 Accept() – Receive a call.
 Send(), Recv() – Talk.
 Close() – Hang up.
The Client – Server model (Socket)
 Server – An entity which is a provider of information.
 Client – An entity which is a seeker of information.
 Example – Apache is a web server providing web pages (information) and Internet
Explorer is a web client which requests those pages from the server.
 In the socket programming world almost all communication is based on
the Client-Server model.
 The Server starts up first and waits for a client to connect to it. After a client
successfully connects, it requests some information. The Server serves this
information to the client. The client then disconnects and the Server waits
for more clients.
A TCP Server - Client Interaction

©spickmlk 21
A UDP Server - Client Interaction

©spickmlk 22
Type of Sockets
 SOCK_STREAM  SOCK_DGRAM
– E.g. TCP – E.g. UDP
– Reliable delivery – Unreliable delivery
– In-order guaranteed – No order guarantees
– Connection-oriented – Connection-less
– Bidirectional – Unidirectional

App D1
App

3 2 3 2
1 socket 1 D2
Dest. socket
D3

You might also like