TCP:

TCP stands for Transmission Control Protocol. It is the most commonly used protocols on the Internet.

When you load a web page, your computer sends TCP packets to the web server’s address, asking it to send the web page to you. The web server responds by sending a stream of TCP packets, which your web browser stitches together to form the web page and display it to you. When you click a link, sign in, post a comment, or do anything else, your web browser sends TCP packets to the server and the server sends TCP packets back. TCP is not just one way communication, the remote system sends packets back to acknowledge it is received your packets.

TCP guarantees the recipient will receive the packets in order by numbering them. The recipient sends messages back to the sender saying it received the messages. If the sender does not get a correct response, it will resend the packets to ensure the recipient received them. Packets are also checked for errors. TCP is all about this reliability, packets sent with TCP are tracked so no data is lost or corrupted in transit. This is why file downloads do not become corrupted even if there are network hiccups. Of course, if the recipient is completely offline, your computer will give up and you will see an error message saying it cannot communicate with the remote host.Source Port and Destination Port fields together identify the two local end points of the particular connection. A port plus its hosts’ IP address forms a unique end point. Ports are used to communicate with the upper layer and distinguish different application sessions on the host.

  • The Sequence Number and Acknowledgment Number fields specify bytes in the byte stream. The sequence number is used for segment differentiation and is useful for reordering or retransmitting lost segments. The Acknowledgment number is set to the next segment expected.
  • Data offset or TCP header length indicates how many 4-byte words are contained in the TCP header.
  • The Window field indicates how many bytes can be transmitted before an acknowledgment is received.
  • The Checksum field is used to provide extra reliability and security to the TCP segment.
  • The actual user data are included after the end of the header.

    UDP:

    UDP stands for User Datagram Protocol, a datagram is the same thing as a packet of information. The UDP protocol works similarly to TCP, but it throws all the error-checking stuff out. All the back-and-forth communication and deliverability guarantees slow things down.

    When using UDP, packets are just sent to the recipient. The sender will not wait to make sure the recipient received the packet — it will just continue sending the next packets. If you are the recipient and you miss some UDP packets, too bad — you cannot ask for those packets again. There is no guarantee you are getting all the packets and there is no way to ask for a packet again if you miss it, but losing all this overhead means the computers can communicate more quickly.

    UDP is used when speed is desirable and error correction is not necessary. For example, UDP is frequently used for live broadcasts and online games.

     

     


     

  • Difference between TCP and UDP?
  • Both TCP and UDP are protocols used for sending bits of data known as packets over the Internet. They both build on top of the Internet protocol. In other words, whether you are sending a packet via TCP or UDP, that packet is sent to an IP address. These packets are treated similarly, as they are forwarded from your computer to intermediary routers and on to the destination.TCP and UDP are not the only protocols that work on top of IP. However, they are the most widely used. The widely used term “TCP/IP” refers to TCP over IP. UDP over IP could just as well be referred to as “UDP/IP”, although this is not a common term.

     

  • IP Classes and Subnet Mask:There are two types of addressing in networking: Physical addressing and logical addressing. The physical address is the MAC address (Media access control) which is fixed for a particular computer. Logical address is the IP (Internet Protocol) address.IP:

    Network IP address is used to identify a host (PC or any network device) in a network. IP is a 32 bit binary number divided into 4 octet groups, each octet giving a maximum of 255 in decimal. For easier addressing of these IP address octet, they are written as dotted decimals.

    How to find out a host IP address? You can go to the command prompt IP address check by typing as shown in the screenshot below

Classes of IP address in networking:

IP is divided into 5 classes of network addresses based on the range of.

 

Class A 0 – 127 Internet work communication
Class B 128 – 191 Internet work communication
Class C 192 – 223 Internet work communication
Class D 224 – 239 Reserved for multicasting
Class E 240 – 254 Reserved for research and experiments

Out of the total valid addresses in each class, two dedicated IP address is reserved for;

  • Network address
  • Broadcast address

 

So the total number of available IP addresses will  be 2n 2

Public and Private IP addresses

To communicate over an internet, a device must have a public IP address which is provided by IANA (Internet Assigned Numbers Authority). Private range of IP addresses in an intranet (an internal network that uses internet technology). IANA also provides for private networks in each class as follows:

Private Network Address Ranges in each Class

 

Class A 10.0.0.0 – 10.255.255.255
Class B 172.16.00 – 172.31.255.255
Class C 192.168.0.0 – 192.168.255.255

 

Before going detail to IP classes we need to know about subnet masks and how to find subnet mask for IP addresses.

Subnet Mask:

is a 32 bit address used with an IP in order to identify its network and host portions.

Please refer the network diagram below for better understanding. Let’s say you’ve got an IP address 200.1.1.2 with a subnet mask 255.255.255.0, it means that 200.1.1 is the network portion and is the host portion. So any IP which starts with 200.1.1 goes to the same network (Network A), like 200.1.1.1, 200.1.1.10, 200.1.1.100 200.1.1.254. And hence they don’t require a router to communicate with each other

In Network the first IP 200.1.1.0 is used to indicate network address and last IP 200.1.1.255 is used to send broadcast messages to all host computers in the network A.

Now another IP 200.1.2.2 which also has the same subnet mask cannot communicate with A without using a router because there’s a change in the network . It belongs to another network with network address 200.1.2.0Network B). Hope you got the point.

Another IP 10.1.1.2 with subnet mask 255.0.0.0 makes you understand that it belongs to the network (Network C), where only the first octet indicates network.

So subnet mask you understand the IP belongs to which network. By default the following subnet masks are used.

 

Class A

Subnet Mask

Network Host Host Host
255 0 0 0
Class B

Subnet Mask

Network Network Host Host
255 255 0 0
Class C

Subnet Mask

Network Network Network Host
255 255 255 0

Note:  All host bits ‘0’ is a network address.

All host bits ‘1’is a broadcast address.

Now let us see network classes A B C D of internet protocol a little deeper.

 

Network Class Ranges with Subnet Mask

Class A Network

Class A network range starts from 1.0.0.0 to 126.255.255.255. See the screenshot for easier understanding.

Class A network subnet mask is 255.0.0.0, which means it has 8 network bits of which the first bit is fixed as ‘0’. And hence a total of 7 network bits and 24 host bitsHence of will be

Here 2 is subtracted as 0.0.0.0 is the default network and 127.0.0.0 is the address used for checking proper functionality (self testing).

And of hosts per network will be

Here 2 is subtracted for network and broadcast address.

Range 1.0.0.0 – 126.255.255.255
Default Subnet Mask 255.0.0.0 (/8)
Network Bits 87[first bit fixed ‘0’]
Host Bits 24
No. network 126
No. host per network 16777214

Class A network example:

Network address -1.0.0.0

Subnet Mask -255.0.0.0

First host IP address -1.0.0.1

Last host address -1.255.255.254

Broadcast address -1.255.255.255

Class B Network

Now class B network range starts from 128.0.0.0 to 191.255.255.255. is 255.255.0.0, which means it has 16 network bits of which first two bits are fixed as ‘10’. And hence a total of 14 network bits and 16 host bits.

So total no. networks will be

And the total number of hosts per network will be

Here also 2 IP’s are subtracted, one for network and other for .

 

Range 192.0.0.0 – 223.255.255.255
Default Subnet Mask 255.255.255.0 (/24)
Network Bits 2421[first 3 bits fixed ‘110’]
Host Bits 8
No. network 2097152
No. host per network 254

Class C network example:

Network address -192.0.0.0

Subnet Mask -255.255.255.0

First host address -192.0.0.1

Last host address -192.0.0.254

Broadcast address -192.0.0.255