circuits.net.sockets – Socket Components

Events

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

Connect Event

This Event is sent when a new client connection has arrived on a server. This event is also used for client’s to initiate a new connection to a remote host.

Note

This event is used for both Client and Server Components.

Parameters:
  • args (tuple) – Client: (host, port) Server: (sock, host, port)
  • kwargs (dict) – Client: (ssl)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Connected(host, port)

Connected Event

This Event is sent when a client has successfully connected.

@note: This event is for Client Components.

Parameters:
  • host – The hostname connected to.
  • port – The port connected to

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Close(*args)

Close Event

This Event is used to notify a client, client connection or server that we want to close.

@note: This event is never sent, it is used to close. @note: This event is used for both Client and Server Components.

Parameters:args – Client: () Server: (sock)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Closed

Closed Event

This Event is sent when a server has closed its listening socket.

@note: This event is for Server components.

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Read(*args)

Read Event

This Event is sent when a client or server connection has read any data.

@note: This event is used for both Client and Server Components.

Parameters:args – Client: (data) Server: (sock, data)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Write(*args)

Write Event

This Event is used to notify a client, client connection or server that we have data to be written.

@note: This event is never sent, it is used to send data. @note: This event is used for both Client and Server Components.

Parameters:args – Client: (data) Server: (sock, data)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Error(*args)

Error Event

This Event is sent when a client or server connection has an error.

@note: This event is used for both Client and Server Components.

Parameters:args – Client: (error) Server: (sock, error)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Disconnect(*args)

Disconnect Event

This Event is sent when a client connection has closed on a server. This event is also used for client’s to disconnect from a remote host.

@note: This event is used for both Client and Server Components.

Parameters:args – Client: () Server: (sock)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.net.sockets.Disconnected

Disconnected Event

This Event is sent when a client has disconnected

@note: This event is for Client Components.

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Components

class circuits.net.sockets.Client(bind=None, bufsize=4096, channel='client')
channel = 'client'
connected
close()
write(data)
class circuits.net.sockets.TCPClient(bind=None, bufsize=4096, channel='client')
connect(host, port, secure=False, **kwargs)
circuits.net.sockets.UDPClient

alias of UDPServer

class circuits.net.sockets.UNIXClient(bind=None, bufsize=4096, channel='client')
ready(component)
connect(path, secure=False, **kwargs)
class circuits.net.sockets.Server(bind, secure=False, backlog=5000, bufsize=4096, channel='server', **kwargs)
channel = 'server'
connected
host
port
close(sock=None)
write(sock, data)
broadcast(data)
class circuits.net.sockets.TCPServer(bind, secure=False, backlog=5000, bufsize=4096, channel='server', **kwargs)
class circuits.net.sockets.UDPServer(bind, secure=False, backlog=5000, bufsize=4096, channel='server', **kwargs)
close()
write(address, data)
broadcast(data, port)
class circuits.net.sockets.UNIXServer(bind, secure=False, backlog=5000, bufsize=4096, channel='server', **kwargs)

Functions

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.