ID EN
Socket

getprotobyname

Python 3.11

Translate an internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function. This is usually only needed for sockets opened in “raw” mode (SOCK_RAW); for the normal socket modes, the correct protocol is chosen automatically if the protocol is omitted or zero.

Syntax

PYTHON
socket.getprotobyname(protocolname)

See Also

socket() SOCK_RAW Availability