Skip to main content

Python TCP and UDP sockets made easy.

Project description

Build Status PyPI - Downloads Coverage Status Codacy Badge

pyeasysocket

Python TCP and UDP sockets made easy.

install

pip install pyeasysocket

quick start

Create a TCPReceiver:

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.

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

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyeasysocket, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pyeasysocket-1.0.0-py3-none-any.whl (6.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page