Package core :: Module net :: Class NetClient

[hide private]
[frames] | no frames]

# Class NetClient

source code

                object --+
                         |
    ssl_support.SSLSupport --+
                             |
                object --+   |
                         |   |
    tcp_support.TCPSupport --+
                             |
                            NetClient

NetClient is an asynchronous factory for TCP or SSL connections.

Multiple connections to different servers can be made using the same instance.

Instance Methods | [hide private]

__init__(self, **kwargs) | source code

set_trust_all(self, val) Should the client trust ALL server certificates | source code

connect(self, port, host, handler) Attempt to open a connection to a server. | source code

close(self) Close the NetClient. | source code

Inherited from `ssl_support.SSLSupport`: `set_key_store_password`, `set_key_store_path`, `set_ssl`, `set_trust_store_password`, `set_trust_store_path` Inherited from `tcp_support.TCPSupport`: `set_receive_buffer_size`, `set_reuse_address`, `set_send_buffer_size`, `set_so_linger`, `set_tcp_keep_alive`, `set_traffic_class`

Class Variables | [hide private]

| trust_all = `property(fset= set_trust_all)`
Inherited from `ssl_support.SSLSupport`: `key_store_password`, `key_store_path`, `ssl`, `trust_store_password`, `trust_store_path` Inherited from `tcp_support.TCPSupport`: `receive_buffer_size`, `reuse_address`, `send_buffer_size`, `so_linger`, `tcp_keep_alive`, `traffic_class`

Method Details | [hide private]

### __init__(self, **kwargs)
(Constructor)

source code

Overrides: object.__init__
  (inherited documentation)

### set_trust_all(self, val)

source code

Should the client trust ALL server certificates

Keyword arguments:

Parameters:
  - `val` - If val is set to true then the client will trust ALL server certificates and will not attempt to authenticate them against it's local client trust store. The default value is false.

    Use this method with caution!

Returns:
  a reference to self so invocations can be chained

### connect(self, port, host, handler)

source code

Attempt to open a connection to a server. The connection is opened asynchronously and the result returned in the handler.

Keyword arguments:

Parameters:
  - `port` - The port to connect to.
  - `host` - The host or ip address to connect to.
  - `handler` - The connection handler
Returns:
  a reference to self so invocations can be chained

### close(self)

source code

Close the NetClient. Any open connections will be closed.