InetSocketAddress

class InetSocketAddress(**properties: Any)

Superclasses: SocketAddress, Object

Subclasses: ProxyAddress

Implemented Interfaces: SocketConnectable

An IPv4 or IPv6 socket address. That is, the combination of a InetAddress and a port number.

In UNIX terms, GInetSocketAddress corresponds to a ``struct sockaddr_in` or struct sockaddr_in6 <man:sockaddr(3type>`_).

Constructors

class InetSocketAddress
classmethod new(address: InetAddress, port: int) SocketAddress

Creates a new InetSocketAddress for address and port.

Added in version 2.22.

Parameters:
classmethod new_from_string(address: str, port: int) SocketAddress | None

Creates a new InetSocketAddress for address and port.

If address is an IPv6 address, it can also contain a scope ID (separated from the address by a %).

Added in version 2.40.

Parameters:
  • address – the string form of an IP address

  • port – a port number

Methods

class InetSocketAddress
get_address() InetAddress

Gets address’s InetAddress.

Added in version 2.22.

get_flowinfo() int

Gets the sin6_flowinfo field from address, which must be an IPv6 address.

Added in version 2.32.

get_port() int

Gets address’s port.

Added in version 2.22.

get_scope_id() int

Gets the sin6_scope_id field from address, which must be an IPv6 address.

Added in version 2.32.

Properties

class InetSocketAddress
props.address: InetAddress

The address.

Added in version 2.22.

props.flowinfo: int

The sin6_flowinfo field, for IPv6 addresses.

Added in version 2.32.

props.port: int

The port.

Added in version 2.22.

props.scope_id: int

The sin6_scope_id field, for IPv6 addresses.

Added in version 2.32.

Fields

class InetSocketAddress
parent_instance
priv