https://github.com/slashgordon/pyeasysocket
Python TCP and UDP sockets made easy.
https://github.com/slashgordon/pyeasysocket
network python3 receiver streamer tcp tcp-client tcp-server udp
Last synced: about 1 year ago
JSON representation
Python TCP and UDP sockets made easy.
- Host: GitHub
- URL: https://github.com/slashgordon/pyeasysocket
- Owner: SlashGordon
- License: mit
- Created: 2019-11-12T08:58:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-19T05:38:28.000Z (almost 5 years ago)
- Last Synced: 2025-03-01T00:48:38.926Z (over 1 year ago)
- Topics: network, python3, receiver, streamer, tcp, tcp-client, tcp-server, udp
- Language: Python
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/SlashGordon/pyeasysocket)

[](https://coveralls.io/github/SlashGordon/pyeasysocket?branch=master)
[](https://www.codacy.com/manual/SlashGordon/pyeasysocket?utm_source=github.com&utm_medium=referral&utm_content=SlashGordon/pyeasysocket&utm_campaign=Badge_Grade)
# pyeasysocket
Python TCP and UDP sockets made easy.
## install
```shell
pip install pyeasysocket
```
## quick start
Create a TCPReceiver:
```python
from pyeasysocket.udp import UDPReceiver
from pyeasysocket.tcp import TCPReceiver
receiver_udp = UDPReceiver('localhost', 8001)
receiver = TCPReceiver('localhost', 8000)
try:
# run background thread for receive
receiver.start()
# wait for data
received_data = receiver.data
finally:
receiver.join() # closes the background thread
```
Or use the advantage of a with statement with the guarantee that the connection will be closed.
```python
import time
from pyeasysocket.tcp import TCPReceiver, TCPClient
client = TCPClient('localhost', 8000)
with TCPReceiver('localhost', 8000) as receiver:
client.send('test')
time.sleep(0.2) # only for timing purpose
received_data = receiver.data # test
```
## issue tracker
[https://github.com/SlashGordon/pyeasysocket/issuese](https://github.com/SlashGordon/pyeasysocket/issues")