# Stem Docs

## Connection Utilities

Connection and networking based utility functions.

Module Overview:

    download - download from a given url
    get_connections - quieries the connections belonging to a given process
    system_resolvers - provides connection resolution methods that are likely to be available
    port_usage - brief description of the common usage for a port

    is_valid_ipv4_address - checks if a string is a valid IPv4 address
    is_valid_ipv6_address - checks if a string is a valid IPv6 address
    is_valid_port - checks if something is a valid representation for a port
    is_private_address - checks if an IPv4 address belongs to a private range or not

    address_to_int - provides an integer representation of an IP address

    expand_ipv6_address - provides an IPv6 address with its collapsed portions expanded
    get_mask_ipv4 - provides the mask representation for a given number of bits
    get_mask_ipv6 - provides the IPv6 mask representation for a given number of bits

stem.util.connection.Resolver(enum)

  Method for resolving a process’ connections.

  Added in version 1.1.0.

  Changed in version 1.4.0: Added NETSTAT_WINDOWS.

  Changed in version 1.6.0: Added BSD_FSTAT.

  Deprecated since version 1.6.0: The SOCKSTAT connection resolver is proving to be unreliable (ticket 23057), and will be dropped in the 2.0.0 release unless fixed.

  Resolver | Description
  --- | ---
  PROC | /proc contents
  NETSTAT | netstat
  NETSTAT_WINDOWS | netstat command under Windows
  SS | ss command
  LSOF | lsof command
  SOCKSTAT | sockstat command under *nix
  BSD_SOCKSTAT | sockstat command under FreeBSD
  BSD_PROCSTAT | procstat command under FreeBSD
  BSD_FSTAT | fstat command under OpenBSD