networking chapter vii

13
Compiled by: Jayakumar Balasubramanian Web: http://www.jwritings.com Email: [email protected]

Upload: jayakumar-balasubramanian

Post on 18-May-2015

382 views

Category:

Technology


1 download

DESCRIPTION

Chapter VII talks about TCP protocol covering three way handshake and RAW socket programming.

TRANSCRIPT

Page 1: Networking chapter VII

Compiled by: Jayakumar BalasubramanianWeb: http://www.jwritings.com

Email: [email protected]

Page 2: Networking chapter VII

Transmission Control Protocol (TCP)

Page 3: Networking chapter VII

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

Page 4: Networking chapter VII

Transport addressing - Ports

Page 5: Networking chapter VII

Ports and services

192.18.22.13

Port 80 25 23

Application WWW E-mail Telnet

Page 6: Networking chapter VII

Ports and services

Page 7: Networking chapter VII

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

Page 8: Networking chapter VII

Connection establishment

Page 9: Networking chapter VII

Connection termination

Page 10: Networking chapter VII

UDP header

Page 11: Networking chapter VII

The RAW sockets

Page 12: Networking chapter VII

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

Page 13: Networking chapter VII

Web : http://www.jwritings.comEmail: [email protected]