DNS utilities

uv.getaddrinfo(host, port, family=0, socktype=0, protocol=0, flags=0, callback=None, loop=None)[source]

Get address information for specified host and port (service).

See uv.dns.GetAddrInfo for parameter descriptions.

Return type:uv.GetAddrInfo | list[uv.AddrInfo]
uv.getnameinfo(ip, port, flags=0, callback=None, loop=None)[source]

Get name information for specified IP and port.

See uv.dns.GetNameInfo for parameter descriptions.

Return type:uv.GetNameInfo | uv.NameInfo

Requests

class uv.dns.GetAddrInfo(host, port, family=0, socktype=0, protocol=0, flags=0, callback=None, loop=None)[source]

Request to get address information for specified host and port (service). If no callback is provided the request is executed synchronously.

Raises:

uv.UVError – error while initializing the handle

Parameters:
  • host (unicode) – host to get address information for
  • port (int) – port (service) to get address information for
  • family (uv.AddressFamilies | int) – address family hint
  • socktype (uv.SocketTypes | int) – socket type hint
  • protocol (uv.SocketProtocols | int) – protocol type hint
  • flags (int) – flags to configure the behavior of getaddrinfo()
  • callback – callback which should be called after address information has been fetched or on error
  • loop (uv.Loop) – event loop the request should run on
callback

Callback which should be called after address information has been fetched or on error.

callback(request, code, addrinfo)
Parameters:
  • request (uv.GetAddrInfo) – request the call originates from
  • code (uv.StatusCodes) – status of the request
  • addrinfo (list[uv.AddrInfo]) – list of fetched address information objects
Readonly:

False

Type:
((uv.GetAddrInfo, uv.StatusCodes, list[uv.AddrInfo])

-> None) |

((Any, uv.GetAddrInfo, uv.StatusCodes, list[uv.AddrInfo])

-> None)

host

Host to get address information for.

Readonly:True
Type:unicode
port

Port (service) to get address information for.

Readonly:True
Type:int
hints

Address information hints.

Readonly:True
Type:uv.AddrInfo
flags

Flags to configure the behavior of getaddrinfo().

Readonly:True
Type:int
addrinfo

Resulting list with address information. Is populated with address information objects after the request has been successfully completed.

Readonly:True
Type:list[uv.AddrInfo]
class uv.dns.GetNameInfo(ip, port, flags=0, callback=None, loop=None)[source]

Request to get name information for specified ip and port. If no callback is provided the request is executed synchronously.

Parameters:
  • ip (unicode) – IP to get name information for
  • port (int) – port to get name information for
  • flags (int) – flags to configure the behavior of getnameinfo()
  • callback (Callable[[uv.GetNameInfo, uv.StatusCodes, unicode, unicode], None]None) – callback which should be called after name information has been fetched or on error
  • loop (uv.Loop) – event loop the request should run on
callback

Callback which should be called after name information has been fetched or on error.

callback(request, code, hostname, service)
Parameters:
  • request (uv.GetNameInfo) – request the call originates from
  • code (uv.StatusCodes) – status of the request
  • hostname (unicode) – hostname corresponding to the given IP
  • service (unicode) – service name corresponding to the given port
Readonly:False
Type:Callable[[uv.GetNameInfo, uv.StatusCodes, unicode, unicode], None]
ip

Ip to get name information for.

Readonly:True
Type:unicode
port

Port to get name information for.

Readonly:True
Type:int
flags

Flags to configure the behavior of getnameinfo().

Readonly:True
Type:int
hostname

Hostname corresponding to the given IP.

Readonly:True
Type:unicode
service

Service name corresponding to the given port.

Readonly:True
Returns:unicode

Data Structures

class uv.Address[source]

Internet Protocol Address

host

Address Host

Return type:unicode
port

Address Port

Return type:int
class uv.Address4[source]

Internet protocol version 4 address.

family = <AddressFamilies.INET4: 2>

Address Family

class uv.Address6[source]

Internet protocol version 6 address.

family = <AddressFamilies.INET6: 10>

Address Family

flowinfo

Address Flow Information

Return type:int
scope_id

Address Scope Id

Return type:int
class uv.AddrInfo[source]

Address Information

family

Address Family

Return type:uv.AddressFamilies | int
socktype

Socket Type

Return type:uv.SocketTypes | int
protocol

Socket Protocol

Return type:uv.SocketProtocols | int
canonname

Canonical Name

Return type:unicode | None
address

Address

Return type:uv.Address | tuple | None
class uv.NameInfo[source]

Name Information

hostname

Hostname

Return type:unicode
service

Service-Name

Return type:unicode

Enumerations

class uv.AddressFamilies[source]

Address Families

UNKNOWN = None

Unknown or unspecified family.

Type:uv.AddressFamilies
INET4 = None

Internet protocol version 4 family.

Type:uv.AddressFamilies
INET6 = None

Internet protocol version 6 family.

Type:uv.AddressFamilies
UNIX = None

Unix domain sockets family.

Type:uv.AddressFamilies
class uv.SocketTypes[source]

Socket Types

STREAM = None

Stream socket type.

Type:uv.SocketTypes
DRGAM = None

Datagram socket type.

Type:uv.SocketTypes
RAW = None

Raw socket type.

Type:uv.SocketTypes
RDM = None

Pragmatic general multicast socket type.

Type:uv.SocketTypes
SEQPACKET = None

Sequence packet socket type.

Type:uv.SocketTypes
class uv.SocketProtocols[source]

Socket Protocols

TCP = None

Transmission control protocol.

Type:uv.SocketProtocols
UDP = None

User datagram protocol.

Type:uv.SocketProtocols
RAW = None

Raw socket protocol.

Type:uv.SocketProtocols
ICMP4 = None

Internet version 4 control message protocol.

Type:uv.SocketProtocols
ICMP6 = None

Internet version 6 control message protocol.

Type:uv.SocketProtocols