Saturday, October 31, 2009

Sockets



Sockets are software abstraction of session layer in OSI model. It is used as a "terminal" between the connection of two machines.
It is a data structure which is an combination of Machine's
IP Address and Ports [1024 - 49151]. These Ports will be pointed to the Machine's Memory Address Space. It paves the way for client-server communication.



netstat # used to view Sockets

Types of Sockets
There are 3 types of sockets, they are
1) SOCK_STREAM
Byte-by-Byte Stream Communication.
Connection Oriented Protocol
Sequenced, Reliable
Bi-directional Data Communication
eg. TCP,SCTP[Stream Controlled]
2) SOCK_DGRAM
Packet-by-Packet
Datagram Communication
Connectionless Protocol
No Ordering of data
Bi-directional Data Communication
eg. UDP

3) SOCK_RAW
Sending and Receiving Data,
bypassing all encapsulation
Packet Headers are not stripped off
eg. ICMP, IGMP, OSPF

Encapsulation of Packet






No comments: