Skip to main content

A package for using a basic protocol socket

Project description

python-simpleprotocol

A small socket wrapper

Used for sending code, subcode, parameters.

Code: Integer

Subcode: Integer

Params: Array of strings

Only has basic use, as shown in this example:

Server:


import simpleprotocol

server = simpleprotocol.SimpleServer(port=8080)

while True:
    handler = server.accept()
    handler.send(0)
    print(handler.get())
    handler = server.accept()
    handler.send(1)
    print(handler.get())


Client:


import simpleprotocol

socket = simpleprotocol.SimpleProtocol()

if socket.get().code:
    socket.send(1, 0, ["That sounds good!"])
else:
    socket.send(1, 1, ["Oh dear, that's not right..."])

Project details


Download files

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

Source Distribution

simpleprotocol-1.0.1.tar.gz (2.9 kB view hashes)

Uploaded source

Built Distribution

simpleprotocol-1.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page