These are communication protocol that allows us to send and recieve data in a network
they reside at layer 4 protocol of OSI model
tcp stands for transmission control protocol , it was designed to allow transmission of information from one server to another by specifying Ip address and port
If certain information is being transferred using tcp then at the end it ensures that yes your information is delivered .
suppose a server sent a message “Hi” to a client then that message will not only contain the text that is transferred it will be more like “ message received Hi ”,
Here message received shows how tcp acknowledges the information i.e sent .
- Guaranteed Delivery
Suppose due to some errors in network or corruption of information occurs in transmission that means information is not sent in that case it will keep sending the information again and again until it receives acknowledge message.
- Connection Based
this means that communication between server can only take place if there is a unique connection between the server’s and that uniqueness comes through the IP address that is if a server sends a information in a network then that information is available to every other serer out there but the information will only be decrypted at the server whose IP address is assigned.
- Congestion Control
Let me explain this using an example of traffic lights ,suppose there is a place where traffic is a lot so when traffic light become green it will only allow one car at a time then it will be back to red that is at a time only one car passes .
So this example shows if there is a lot traffic of packets [HERE PACKETS ARE PACK OF INFORMATION] in network then TCP will allow only one packet at a time . This leads to delay in transmission of information.
- Ordered Packets
It guarantees delivery of data and also it delivers packets in same order as they were sent.
- Larger packets
Since it has to carry more instruction along with information which is to be sent , those instruction includes packet for acknowledgement ,headers for guaranteed delivery ,packets for congestion control etc in order to carry all these information in headers it leads to larger packets .See anything which has advantages comes with drawback too .
- More bandwidth
Larger packets leads to more bandwidth , if you are on a 2g 0r 3g network god knows how long will it take to transmit information.
- Slower Than UDP
Will talk about UDP in later section of this blog , now what we needs to know is that with other formalities like congestion control [about which we have already discussed] ,also we have to wait for acknowledgement , we have to wait for guaranteed delivery these all things leads to delay in transmission of information.
If you can restart your server and the client does not remain connected with the server plus can not resume the work without any interruption this refers to stateful.
In TCP server have the connection details of client and client also have the information about connection detail of server therefore if serer is shutdown or interrupted the connection will be lost now if client wants to send some information it won’t able to.
it stands for User Datagram Protocol
- No Acknowledgement
so if you send the data using UDP the serer won’t tell you that if client recieve the data or not
- No Guaranteed Delivery
In this if data is once transmitted that’s it no re-transmission of data take place in case if data doesn’t reach to user. If information reaches it reaches if doesn’t then it doesn’t.
- Connection less
So there is no connection between server and client , server doesn’t know who the client is and client doesn’t know who the server is . Therefore it’s not secure
- No Congestion Control
So in this UDP will keep sending information if it is asked to it doesn’t care if there is traffic of packets or not.
- No Ordered Packets
If UDP is asked to send 5 packets , then it will send those packets as it is there will be no order followed
- Smaller Packets
See it’s quite opposite to TCP in UDP there is no acknowledgement , no order information , no congestion control , no connection details there are no headers to carry all these information which leads to the smaller packets
- Low bandwidth
If there is low data then you don’t need much bandwidth to transfer that data basically smaller packets leads to low bandwidth
- Faster Than TCP
See its very clear from the drawacks of UDP that it doesn’t have to wait for acknowledgement ,neither for connection or there is not even congestion control whereas in TCP it’s quite opposite these all factors lead to faster delivery of data as compared to TCP .
If you can restart your server and the client remain connected with the server plus can resume the work without any interruption this refers to stateless .