Skip to content

Commit

Permalink
README.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Jun 15, 2023
1 parent 5f846ab commit 62b859b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ Installation
$ pip install asyncudp
Example client
==============

.. code-block:: python
import asyncio
import asyncudp
async def main():
sock = await asyncudp.create_socket(remote_addr=('127.0.0.1', 9999))
sock.sendto(b'Hello!')
print(await sock.recvfrom())
sock.close()
asyncio.run(main())
Example server
==============

.. code-block:: python
import asyncio
import asyncudp
async def main():
sock = await asyncudp.create_socket(local_addr=('127.0.0.1', 9999))
while True:
data, addr = await sock.recvfrom()
print(data, addr)
sock.sendto(data, addr)
asyncio.run(main())
Test
====

Expand Down

0 comments on commit 62b859b

Please sign in to comment.