The Go standard library allows us to easily interact with the transport layer, using both TCP and UDP connections. In this section, we will look at how to expose a service using a socket and how to look it up and use it from another application.
Understanding socket programming
Network package
The tools needed to create and handle a TCP connection are located inside the net package. The main interface of the package is Conn, which represents a connection.
It has four implementations:
- IPConn: Raw connection that uses the IP protocol, the one that TCP and UDP connection are built on
- TCPConn: An IP connection that uses the TCP protocol
- UDPConn: An IP connection that uses the UDP protocol
- UnixConn: A Unix domain socket, where...