Behind the scenes connectivity¶
-
class
ngtt.uplink.connection.NGTTSocket(cert_file: str, key_file: str)¶ -
close()¶ Check if the resource needs cleanup, and clean up this resource.
Use like this:
>>> class MyClose(Closeable): >>> def close(self): >>> if super().close(): >>> .. clean up ..
- Returns
whether the cleanup should proceed
- Raises
RuntimeError – the constructor was not invoked
-
connect()¶ Connect to remote host
- Raises
SSLError – an error occurred
-
disconnect()¶ Disconnect from the remote host
-
recv_frame() → Optional[Tuple[int, ngtt.protocol.NGTTHeaderType, bytes]]¶ Receive a frame from remote socket
- Raises
ConnectionFailed – connection closed
- Returns
a tuple of transaction ID, header type, data
-
send_frame(tid: int, header: ngtt.protocol.NGTTHeaderType, data: bytes = b'') → None¶ Schedule a frame to be sent
- Parameters
tid – transaction ID
header – packet type
data – data to send
-
try_send()¶ Try to send some data
-