Skip to content

Commit 1f295c5

Browse files
committed
add documentation about context manager for udp client
1 parent 791ea4a commit 1f295c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/client.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Examples
2323
client.send_message("/some/address", 123) # Send float message
2424
client.send_message("/some/address", [1, 2., "hello"]) # Send message with int, float and string
2525
26+
# Alternatively, use a context manager to automatically close the socket
27+
with SimpleUDPClient(ip, port) as client:
28+
client.send_message("/some/address", 123)
29+
2630
2731
.. code-block:: python
2832

0 commit comments

Comments
 (0)