UDP¶
A UDP SMPTransport for Network connections like Wi-Fi or Ethernet.
logger = logging.getLogger(__name__)
module-attribute
¶
SMPUDPTransport
¶
Bases: SMPTransport
Source code in smpclient/transport/udp.py
mtu: int
property
¶
The Maximum Transmission Unit (MTU) in 8-bit bytes.
__init__(mtu: int = 1500) -> None
¶
Initialize the SMP UDP transport.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mtu |
int
|
The Maximum Transmission Unit (MTU) in 8-bit bytes. |
1500
|
connect(address: str, timeout_s: float, port: int = 1337) -> None
async
¶
Connect the SMPTransport
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
address |
str
|
The SMP server address. |
required |
timeout_s |
float
|
The connection timeout in seconds. |
required |
Source code in smpclient/transport/udp.py
disconnect() -> None
async
¶
Disconnect the SMPTransport
.
Source code in smpclient/transport/udp.py
send(data: bytes) -> None
async
¶
Send the encoded SMPRequest
data
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The encoded |
required |
Source code in smpclient/transport/udp.py
receive() -> bytes
async
¶
Receive the decoded SMPResponse
data.
Returns:
Type | Description |
---|---|
bytes
|
The |
Source code in smpclient/transport/udp.py
send_and_receive(data: bytes) -> bytes
async
¶
Send the encoded SMPRequest
data
and receive the decoded SMPResponse
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The encoded |
required |
Returns:
Type | Description |
---|---|
bytes
|
The |