On this page
socket.ntohs
Prev: socket.ntohl | Up: socket | Next: socket.recv_fds
Rel: socket.AddressFamily, socket.close, socket.create_connection, socket.create_server
Ref: docs.python.org — socket.ntohs
Tags: #public #python3 #stdlib #socket
Import
import socket
from socket import ntohs
Signature & Overview
socket.ntohs(integer, /)
Convert a 16-bit unsigned integer from network to host byte order.
Usage
import socket
assert socket.ntohs(socket.htons(443)) == 443
Gotchas
- Network-to-host 16-bit byte-order conversion: Inverse of
htons().
REPL Inspect
from socket import ntohs
help(ntohs)
Linked from
Related notes
- tuts/python3/stdlib_module/socket/ntohl Linked here; links to this page; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/recv_fds Linked here; links to this page; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/AddressFamily Linked here; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/close Linked here; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/create_connection Linked here; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/create_server Linked here; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/socket Linked here; shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/socket/dup shared tags: #socket, #stdlib
- tuts/python3/stdlib_module/socket/error shared tags: #socket, #stdlib