Socket types

Currently, there are several types of sockets, and each one is usually associated with a type of protocol, for example:

  • SOCK_STREAM: It is associated with the TCP protocol and provides security in the transmission of data and security in the data reception.
  • SOCK_DGRAM: It is associated with the UDP protocol and indicates that packets will travel in the datagram type, which has an asynchronous communication style.

Sockets can also be classified according to their family. We have Unix sockets, socket.AF_UNIX, which were created before the concept of networks and are based on files, socket.AF_INET for the IPv4 protocol, and socket.AF_INET6 for working with IPv6.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset