networking chapter vii
DESCRIPTION
Chapter VII talks about TCP protocol covering three way handshake and RAW socket programming.TRANSCRIPT
Compiled by: Jayakumar BalasubramanianWeb: http://www.jwritings.com
Email: [email protected]
Transmission Control Protocol (TCP)
The TCP service modelUnderlying media is ‘unreliable’An ‘end-to-end’ connection oriented, reliable
protocol is requiredTCP functionalities:
Service mapping based on port numbers Congestion control Connection establishment and termination Acknowledgement Timeout and re-transmission
Transport addressing - Ports
Ports and services
192.18.22.13
Port 80 25 23
Application WWW E-mail Telnet
Ports and services
How does TCP achieve all this?The TCP maintains a method called as
‘three-way-handshake’ for connection establishment
The connection termination also happens in a pre-defined way
Since both ends know each other, the ‘connectedness’ comes is achieved
Various flag fields are used: ACK, SYN, RST, FIN
Connection establishment
Connection termination
UDP header
The RAW sockets
How to program RAW sockets?Use simple socket() call with some different
parametersCreating a RAW socket:
TCP protocol: IPPROTO_TCP UCP protocol: IPPROTO_UDP
socket (AF_INET,SOCK_DGRAM,IPPROTO_IP)
Sending and receiving data: Send: write() system call Receive: read() system call
Can be used for any packet capturing and analyzing protocol
Web : http://www.jwritings.comEmail: [email protected]