InetSocketAddress#
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
foraddress
andport
.Added in version 2.22.
- Parameters:
address – a
InetAddress
port – a port number
- classmethod new_from_string(address: str, port: int) SocketAddress | None #
Creates a new
InetSocketAddress
foraddress
andport
.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
'sInetAddress
.Added in version 2.22.
Properties#
- class InetSocketAddress
- props.address: InetAddress#
The type of the None singleton.
Added in version 2.22.