You are here : python_3socketsocketfromfd

socket.fromfd() - socket

Duplicate the file descriptor fd (an integer as returned by a file object’s
fileno() method) and build a socket object from the result.  Address
family, socket type and protocol number are as for the socket() function
above. The file descriptor should refer to a socket, but this is not checked —
subsequent operations on the object may fail if the file descriptor is invalid.
This function is rarely needed, but can be used to get or set socket options on
a socket passed to a program as standard input or output (such as a server
started by the Unix inet daemon).  The socket is assumed to be in blocking mode.


Syntax

socket.fromfd(fd, family, type, proto=0)


Example


Output / Return Value


Limitations


Alternatives / See Also


Reference