Compiled by: Jayakumar Balasubramanian Web:  http://www.jwritings.com Email:  [email_address]
Transmission Control Protocol (TCP)
The TCP service model Underlying media is ‘unreliable’ An ‘end-to-end’ connection oriented, reliable protocol is required TCP 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 parameters Creating 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.com Email:  [email_address]

Networking chapter VII

  • 1.
    Compiled by: JayakumarBalasubramanian Web: http://www.jwritings.com Email: [email_address]
  • 2.
  • 3.
    The TCP servicemodel Underlying media is ‘unreliable’ An ‘end-to-end’ connection oriented, reliable protocol is required TCP functionalities: Service mapping based on port numbers Congestion control Connection establishment and termination Acknowledgement Timeout and re-transmission
  • 4.
  • 5.
    Ports and services 192.18.22.13 Port 80 25 23 Application WWW E-mail Telnet
  • 6.
  • 7.
    How does TCPachieve 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
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    How to programRAW sockets? Use simple socket() call with some different parameters Creating 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
  • 13.
    Web : http://www.jwritings.com Email: [email_address]