pynetdicom.transport.AssociationServer

class pynetdicom.transport.AssociationServer(ae, address, ssl_context=None, evt_handlers=None)[source][source]

An Association server implementation.

Any attempts to connect will be assumed to be from association requestors.

The server should be started with serve_forever(poll_interval), where poll_interval is the timeout (in seconds) that the select.select() call will block for (default 0.5). A value of 0 specifies a poll and never blocks. A value of None blocks until a connection is ready.

ae

The parent AE that is running the server.

Type

ae.ApplicationEntity

request_queue_size

Default 5.

Type

int

server_address

The (host, port) that the server is running on.

Type

2-tuple

ssl_context

The SSLContext used to wrap client sockets, or None if no TLS is required (default).

Type

ssl.SSLContext or None

__init__(ae, address, ssl_context=None, evt_handlers=None)[source][source]

Create a new AssociationServer, bind a socket and start listening.

Parameters
  • ae (ae.ApplicationEntity) – The parent AE that’s running the server.

  • address (2-tuple) – The (host, port) that the server should run on.

  • ssl_context (ssl.SSLContext, optional) – If TLS is to be used then this should be the ssl.SSLContext used to wrap the client sockets, otherwise if None then no TLS will beused (default).

  • evt_handlers (list of 2-tuple, optional) – A list of (event, callable), the callable function to run when event occurs.

Methods

__init__(ae, address[, ssl_context, ...])

Create a new AssociationServer, bind a socket and start listening.

bind(event, handler)

Bind a callable handler to an event.

close_request(request)

Called to clean up an individual request.

fileno()

Return socket file number.

finish_request(request, client_address)

Finish one request by instantiating RequestHandlerClass.

get_events()

Return a list of currently bound events.

get_handlers(event)

Return handlers bound to a specific event.

get_request()

Handle a connection request.

handle_error(request, client_address)

Handle an error gracefully.

handle_request()

Handle one request, possibly blocking.

handle_timeout()

Called if no new request arrives within self.timeout.

process_request(request, client_address)

Process a connection request.

serve_forever([poll_interval])

Handle one request at a time until shutdown.

server_activate()

Called by constructor to activate the server.

server_bind()

Bind the socket and set the socket options.

server_close()

Close the server.

service_actions()

Called by the serve_forever() loop.

shutdown()

Completely shutdown the server and close it's socket.

shutdown_request(request)

Called to shutdown and close an individual request.

unbind(event, handler)

Unbind a callable handler from an event.

verify_request(request, client_address)

Verify the request.

Attributes

active_associations

Return the server's running Association acceptor instances

address_family

allow_reuse_address

request_queue_size

socket_type

timeout