What are TCP and UDP protocols in tcp ip protocol suits
Posted By : Prashank Jauhari | 18-Dec-2017
What are TCP and UDP in TCP/IP protocol suits
TCP:
Transmission control protocol is a connection-oriented protocol. By connection oriented I mean that a three-way handshake is performed before establishing the actual socket connection. One objective of TCP 3 way handshake is to infer out if the server can accept new connection i.e it has available ports.The other information they exchange with the 3-way handshake is there ISN(initial sequence no value). ISN helps in maintaining the flow control and error control i.e keeping track of information about the no of packets another party has successfully received. ISN is exchanged using SYN and ACK datagram packets in 3 way handshake.
Features of TCP:
1)flow control through sliding window protocol.
2)Error control through CRC check.
3)It is reliable(i.e it will resend the packets if it do not receive acknowledgment for packet from receiver)
4)Packet are ordered in case of TCP, It is done through ISN(initial sequence no value discussed above)
3)TCP is slow as compared to UPD because of above such feature.
Application that use tcp are HTTP,FTP,telnet etc
UDP:
User Datagram Protocol is a connectionless protocol i.e no handshake is performed before establishing the actual socket connection. It does not do any error control, flow control checks and it is less reliable as compared to TCP connection. UDP does not do any check control as it is fast.
The applications that use UDP are VoIP(voice over IP, DHCP, SNMP) etc.
Example code are as under
tcpclient.c
As I mention as the three-way handshake is performed through connect system call to the above code before send and write System call.
udpclient.c
Notice that in the above code sendto and recvfrom system calls are initiated without establishing connection i.e without establishing handshake.
For for information about network programming at more basic level please go through Unix network programming by R.W steven. Here is a link to that
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Prashank Jauhari
Prashank is quick learner and passionate about new technologies. He is currently working as Java Developer with knowledge of Spring and Hibernate.