TCP connections

The TCP is the protocol that is most used on the internet, and it enables delivery of data (bytes) that are ordered. The main focus of this protocol is reliability, which is obtained by establishing a two-way communication, where the receiver sends an acknowledgement signal each time it receives a datagram successfully. 

A new connection can be created using the net.Dial function. It is a generic function that accepts different networks, such as the following:

  • tcp, tcp4 (IPv4-only), tcp6 (IPv6-only)
  • udp, udp4 (IPv4-only), udp6 (IPv6-only)
  • ip, ip4 (IPv4-only), ip6 (IPv6-only)
  • unix (socket stream), unixgram (socket datagram), and unixpacket (socket packet)

A TCP connection can be created, specifying the tcp protocol, together ...

Get Hands-On System Programming 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.