Tcp vs Udp

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/tcp-vs-udp/
PINTEREST
PINTEREST
INSTAGRAM

Networks are used to transmit data over the world. There is a lot of network protocols in use. But most known and used protocols are IP,TCP,UDP. IP lives different flat but TCP and UDP try to live same flat. So they operate same network layer but what is different between UDP and TCP. Why should I use TCP or not to use? Same questions can be asked for UDP too.In this post we will look what are same and different for these protocol. TCP stands for Transmission Control Protocol. UDP stands for User Datagram Protocol

OSI Network Layer

They both live same Layer according to OSI Reference Model. We call this layer as Transmission Layer. In this layer between sockets data is transmitted. They have no difference in this side.

Packet Structure

Udp have lean package structure. UDP provides just Source, Destination Port, Length,Checksum in its header part.

TCP have more field in the package because TCP transmission have more steps and controls for package delivery. TCP have 12 header field.

Complexity

TCP is absolutely more complex than UDP protocol. As we see in the upper side TCP have a lot of area for transmission related mechanisms. For example TCP provides windows mechanism which sets transmission buffer related memory.

UDP have just checksum mechanism and packet counter which is some times not implemented.

Algorithm

To transmit data with TCP a session must be created with a method named 3 way hand shake. First client send a packet with SYNC flag is set and then server responds with ACK flags and the last step client sends SYNC+ACK to accomplish a TCP session with related server.

LEARN MORE  Linux Top - Monitor Linux System Resources Cpu, Memory, Network

UDP do not have any special algorithm. UDP packages are directly send to the servers port. Management done generally in the upper application layer.

Speed

Complexity of TCP protocol makes TCP slower than UDP. At least to send just a single byte there need to be a session initialization and after data transfer close the session. This makes TCP slower. There are some work done about speed of  TCP but the architecture is limits new enhancements.

UDP is light fast if you transmit it over fiber optic 😉 .UDP is fast because there is no algorithms for session or session termination.

Reliability

TCP is reliable protocol because it runs mechanisms to prevent data loss or change. TCP uses sessions to make data transmission reliable. Also in the data transfer transmitted data is checked by between sides and if some loss or change occurred data is re-transmitted again.

UDP is nor reliable. Really it is not. But if you want it to be reliable upper layer application level mechanisms can be implemented but these will make the transmission more complex.

Security

From security point of view both TCP and UDP is the same. Actually TCP have some little advantages because of its session management but for a general look their are both secure if security mechanisms like SSL, Encryption is implemented. Implementing SSL/TLS like protocols for TCP is very easy beside UDP. On the other side voice communication protocol like RTP can be upgraded to the SRTP to make underlying UDP more secure.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/tcp-vs-udp/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)