You are here : python_3socketsocketsocket

socket.socket() - socket

Create a new socket using the given address family, socket type and protocol
number.  The address family should be AF_INET (the default),
AF_INET6, AF_UNIX, AF_CAN or AF_RDS. The
socket type should be SOCK_STREAM (the default),
SOCK_DGRAM, SOCK_RAW or perhaps one of the other SOCK_
constants. The protocol number is usually zero and may be omitted or in the
case where the address family is AF_CAN the protocol should be one
of CAN_RAW or CAN_BCM.  If fileno is specified, the other
arguments are ignored, causing the socket with the specified file descriptor
to return.  Unlike socket.fromfd(), fileno will return the same
socket and not a duplicate. This may help close a detached socket using
socket.close().


Syntax

socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)


Example


Output / Return Value


Limitations


Alternatives / See Also


Reference