Package core :: Module net :: Class NetServer |
[hide private]
[frames] | no frames]

# Class NetServer

source code

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

Represents a TCP or SSL Server

When connections are accepted by the server they are supplied to the user in the form of a NetSocket instance that is passed via the handler set using connect_handler.

Instance Methods | [hide private]
__init__(self, **kwargs) | source code
set_client_auth_required(self, val) Client authentication is an extra level of security in SSL, and requires clients to provide client certificates. | source code
connect_handler(self, handler) Supply a connect handler for this server. | source code
listen(self, port, host="0.0.0.0") Instruct the server to listen for incoming connections. | source code
close(self, handler=None) Close the server. | 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]
| client_auth_required = `property(fset= set_client_auth_required)`
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_client_auth_required(self, val) | source code
Client authentication is an extra level of security in SSL, and requires clients to provide client certificates. Those certificates must be added to the server trust store. Parameters: `val` - If true then the server will request client authentication from any connecting clients, if they do not authenticate then they will not make a connection.

### connect_handler(self, handler) | source code
Supply a connect handler for this server. The server can only have at most one connect handler at any one time. As the server accepts TCP or SSL connections it creates an instance of NetSocket and passes it to the connect handler. Keyword arguments: Parameters: `handler` - connection handler Returns: a reference to self so invocations can be chained

### listen(self, port, host="0.0.0.0") | source code
Instruct the server to listen for incoming connections. Keyword arguments: Parameters: `port` - The port to listen on. `host` - The host name or ip address to listen on. Returns: a reference to self so invocations can be chained

### close(self, handler=None) | source code
Close the server. The handler will be called when the close is complete.