# circuits.net.sockets module

Socket Components

This module contains various Socket Components for use with Networking.

circuits.net.sockets.wrap_socket(sock, keyfile=None, certfile=None, ca_certs=None, purpose=Purpose.SERVER_AUTH, verify_mode=None, minimum_version=_SSLMethod.PROTOCOL_TLS, check_hostname=None, **kwargs)

circuits.net.sockets.do_handshake(sock, on_done=None, on_error=None, extra_args=None)

  SSL Async Handshake

  Parameters:

    - on_done – Function called when handshake is complete

    - on_error – Function called when handshake errored

class circuits.net.sockets.Client(*args, **kwargs)

  Bases: `BaseComponent`

  Initializes x; see x.__class__.__doc__ for signature

  channel = 'client'
  socket_family = 2
  socket_type = 1
  socket_protocol = 0
  socket_options = []
  parse_bind_parameter(bind_parameter)
  property connected
  close()
  write(data)

class circuits.net.sockets.TCPClient(*args, **kwargs)

  Bases: `Client`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 2
  socket_type = 1
  socket_protocol = 6
  socket_options = [(6, 1, 1)]
  init(connect_timeout=5, *args, **kwargs)
  connect(host, port, secure=False, **kwargs)

class circuits.net.sockets.TCP6Client(*args, **kwargs)

  Bases: `TCPClient`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 10
  parse_bind_parameter(bind_parameter)

class circuits.net.sockets.UNIXClient(*args, **kwargs)

  Bases: `Client`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 1
  socket_type = 1
  socket_options = []
  ready(component)
  connect(path, secure=False, **kwargs)

class circuits.net.sockets.Server(*args, **kwargs)

  Bases: `BaseComponent`

  Initializes x; see x.__class__.__doc__ for signature

  channel = 'server'
  socket_protocol = 0
  parse_bind_parameter(bind_parameter)
  property connected
  property host
  property port
  close(sock=None)
  write(sock, data)
  starttls(sock)

class circuits.net.sockets.TCPServer(*args, **kwargs)

  Bases: `Server`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 2
  socket_type = 1
  socket_options = [(1, 2, 1), (6, 1, 1)]
  parse_bind_parameter(bind_parameter)

circuits.net.sockets.parse_ipv4_parameter(bind_parameter)

circuits.net.sockets.parse_ipv6_parameter(bind_parameter)

class circuits.net.sockets.TCP6Server(*args, **kwargs)

  Bases: `TCPServer`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 10
  parse_bind_parameter(bind_parameter)

class circuits.net.sockets.UNIXServer(*args, **kwargs)

  Bases: `Server`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 1
  socket_type = 1
  socket_options = [(1, 2, 1)]

class circuits.net.sockets.UDPServer(*args, **kwargs)

  Bases: `Server`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 2
  socket_type = 2
  socket_options = [(1, 6, 1), (1, 2, 1)]
  close()
  write(address, data)
  broadcast(data, port)

circuits.net.sockets.UDPClient

  alias of `UDPServer`

class circuits.net.sockets.UDP6Server(*args, **kwargs)

  Bases: `UDPServer`

  Initializes x; see x.__class__.__doc__ for signature

  socket_family = 10
  parse_bind_parameter(bind_parameter)

circuits.net.sockets.UDP6Client

  alias of `UDP6Server`

circuits.net.sockets.Pipe(*channels, **kwargs)

  Create a new full duplex Pipe

  Returns a pair of UNIXClient instances connected on either side of the pipe.