On this page
  1. socket.inet_aton
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

socket.inet_aton

Prev: socket.if_nametoindex | Up: socket | Next: socket.inet_ntoa
Rel: socket.AddressFamily, socket.close, socket.create_connection, socket.create_server
Ref: docs.python.org — socket.inet_aton
Tags: #public #python3 #stdlib #socket


Import

import socket
from socket import inet_aton

Signature & Overview

socket.inet_aton(ip_addr, /)

Convert an IP address in string format (123.45.67.89) to the 32-bit packed binary format used in low-level network functions.

Usage

import socket

assert socket.inet_aton("127.0.0.1") == b"\x7f\x00\x00\x01"

Gotchas

REPL Inspect

from socket import inet_aton
help(inet_aton)

Linked from

Related notes