cai.connection package¶
Low Level Async TCP Connection
This module is used to build a async TCP connection to target.
- Copyright
Copyright (C) 2021-2021 cscs181
- License
AGPL-3.0 or later. See LICENSE for detail.
- class cai.connection.Connection(host: str, port: int, ssl: bool = False, timeout: Optional[float] = None)¶
基类:
object- property host: str¶
- property port: int¶
- property ssl: bool¶
- property writer: asyncio.streams.StreamWriter¶
- property reader: asyncio.streams.StreamReader¶
- property closed: bool¶
- async close()¶
- async reconnect() None¶
- async read_bytes(num_bytes: int)¶
- async read_line()¶
- async read_all()¶
- write(data: Union[bytes, cai.utils.binary.Packet])¶
- write_eof()¶
- async awrite(data: Union[bytes, cai.utils.binary.Packet])¶
- cai.connection.connect(host: str, port: int, ssl: bool = False, timeout: Optional[float] = None) cai.utils.coroutine.ContextManager[Any, Any, cai.connection.Connection]¶
Submodules¶
cai.connection.utils module¶
Connection Related tools
This module is used to build tcp latency test and other convenient tools.
- Copyright
Copyright (C) 2021-2021 cscs181
- License
AGPL-3.0 or later. See LICENSE for detail.
- async cai.connection.utils.tcp_latency_test(host: str, port: int, timeout: float = 5.0) float¶