What is the difference between UDP and the TCP protocol?
Both the protocols differ in the way they carry out communication , also both are network layer protocols . A TCP protocol establishes a two way connection between a pair of computers , while the UDP protocol is one-way message sender. That is in TCP, Acknowledgement is also sent after receiving the message while there is no such acknowledgement sent after receiving the message in UDP.
TCP and UDP are both communication network protocols. TCP protocol in its essence is to guarantee delivery of information, and in the order sent. UDP protocol is lighter, by fact of not checking for the connection to be ready to receive on the other end, not checking if the information getting to the other end is correctly received.
Both the protocols differ in the way they carry out the action of communicating. A TCP protocol establishes a two way connection between a pair of computers , while the UDP protocol is one-way message sender. The common analogy is that TCP is like making a phone call and carrying on a two-way communication, while UDP is like mailing a letter.
A datagram socket represents a connectionless, non-guaranteed communication protocol. It represents the UDP protocol in the TCP/IP suite. Contrast this with a stream socket, which represents a connection oriented, guaranteed, communication protocol. It represents the TCP protocol in the TCP/IP suite. UDP is the underlying protocol for TCP. If you are talking OSI model, UDP is layer 3, and TCP is layer 4.
TCP is a connection protocol and UDP is a connection-less protocol. TCP are used when you want to control the quality to the receiver. I.e. you send the package and the receiver acknowledge that the package is received ok. FTP and HTTP are two examples. With UDP you just send the data to whoever requests it, it can even be to multiple users. For example, video streaming. UDP is much faster then TCP.
Explain the difference between a connection-oriented protocol and a connectionless protocol and give an example of each?
Different from a connectionless protocol, a connection-oriented protocol guaranties the delivery of the information. An example of connection-oriented protocol is (TCP) and a connectionless protocol is (UDP). TCP is a connection-oriented protocol, it makes a connection and checks whether the data is received, and resends if it is not. UDP is a connectionless protocol, it does not guarantee delivery by first connecting and checking whether data is received.