The difference between TCP and UDP is connection(TCP) and connectionless(UDP) protocol.Because In TCP for transferring every Packets it needs a acknowledgement packet from receiver ,so if any packet loss happens receiver will not send a acknowledgement for that packet so Transmitter will once again send the packet.so TCP is reliable connection unless UDP will send a packet and will not expect any acknowledgment from the receiver so it is not reliable.