I am learning about sockets in Python and came up with
variable = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
I understood the function of this socket.socket
and socket.AF_INET
but I am curious about socket.SOCK_STREAM
. What is its function?
SOCK_STREAM
means that it is a TCP socket.
SOCK_DGRAM
means that it is a UDP socket.
These are used 99% of the time. There are other possibilities as well, see https://docs.python.org/2/library/socket.html#socket.SOCK_STREAM (you will have to google for the meaning of each one).