Question: what is the difference between tcp and udp sockets?
Answer: There are some fundamental differences between TCP and UDP sockets. UDP is a connection-less, unreliable, datagram protocol (TCP is instead connection-oriented, reliable and stream based). ... recvfrom returns the IP address of the client, along with the datagram, so the server can send a response to the client.