pynetdicom.transport.AssociationSocket¶
- class pynetdicom.transport.AssociationSocket(assoc, client_socket=None, address=('', 0))[source][source]¶
A wrapper for a
socket.socketobject.Provides an interface for
socket.socketthat is integrated nicely with anAssociationinstance and the state machine.- select_timeout¶
The timeout (in seconds) that
select.select()calls inready()will block for (default0.5). A value of0specifies a poll and never blocks. A value ofNoneblocks until a connection is ready.
- tls_args¶
If the socket should be wrapped by TLS then this is
(context, hostname), where context is assl.SSLContextthat will be used to wrap the socket and hostname is the value to use for the server_hostname keyword argument forSSLContext.wrap_socket()If TLS is not to be used thenNone(default).- Type
2-tuple or None
- __init__(assoc, client_socket=None, address=('', 0))[source][source]¶
Create a new AssociationSocket.
- Parameters
assoc (association.Association) – The
Associationinstance that will be using the socket to communicate.client_socket (socket.socket, optional) – The
socketto wrap, if not supplied then a new socket will be created instead.address (2-tuple, optional) – If client_socket is
Nonethen this is the(host, port)to bind the newly created socket to, which by default will be('', 0).
Methods
__init__(assoc[, client_socket, address])Create a new AssociationSocket.
close()Close the connection to the peer and shutdown the socket.
connect(address)Try and connect to a remote at address.
recv(nr_bytes)Read nr_bytes from the socket.
send(bytestream)Try and send the data in bytestream to the remote.
Attributes
assocReturn the socket's parent
Associationinstance.event_queueReturn the Association's event queue.
readyReturn
Trueif there is data available to be read.