TCP and UDP sockets

Sockets are the building blocks of networking. Servers listen and clients dial using sockets to bind together and share information. The Internet Protocol (IP) layer specifies the address of a machine, but the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP) specify which port on the machine should be used.

The main difference between the two is the connection state. TCP keeps the connection alive and verifies that messages are received. UDP just sends a message off without receiving an acknowledgement from the remote host.

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.