Google Class Code: S52budw
Google Class Code: S52budw
Google Class Code: S52budw
s52budw
The communication process between servers and clients (e.g. echo server
process).
©spickmlk 2
©spickmlk 3
DNS - Domain Name System
The communication process between servers and clients (e.g. echo server
process).
©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).
©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
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”
©spickmlk 16
Socket Programming
“Telephone Analogy”
A telephone call over a “telephony network” works as follows:
©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