Skip to main content

Introduction

This library allows to easily create TCP Servers and Clients using Python sockets

If you want a secure connection, use the secure variant securesockets. It uses the pycryptodome library. It should be clear, that you need to install said library to use the secure variant.
If you have encountered a bug or have an idea, share it on github. For more help look up the docs (Note: They may be incomplete)

Installation

use pip install simplesockets to install this library.

Examples

This package also contains an example, an echo Server and Client:

echoclient.py

if __name__ == "__main__":
    from simplesockets import TCPClient

    Client = TCPClient()
    Client.setup(target_ip="localhost", target_port=25567)  # prepares the Client
    Client.connect()  # connects the Client to the Server

    Client.autorecv()  # enables autorecv: automatically saves all incoming data in Client.recved_data,
    # return them with Client.return_recved_data()

    Client.send_data(b'Test')  # sends the text to the Server
    while True:
        if Client.event.new_data:  # checks if any data received
            data: list = Client.return_recved_data()  # returns the received data as a list
            for element in data:
                print(element.response)  # should print b'Test'
            break  # ends the while loop

echoserver.py

if __name__ == "__main__":
    from simplesockets import TCPServer

    Server = TCPServer()
    Server.setup(ip='127.0.0.1', port=25567)  # prepares the server
    Server.start()  # starts the server

    while True:
        if Server.event.new_data:  # checks if any data received
            data: list = Server.return_recved_data()  # returns the received data as a list
            for element in data:
                response: bytes = element.response  # element is a Socket_Response object,
                client = element.from_  # sets client to a Server_Client object
                Server.send_data(response, client)

Release files for simplesockets 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simplesockets 0.4.0
File Size Uploaded
simplesockets-0.4.0.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simplesockets 0.4.0
File Interpreter ABI Platform
simplesockets-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.2 kB

Release files / simplesockets-0.4.0.tar.gz

Download URL simplesockets-0.4.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
55fb4ceaca27423637ae357cf5b4438601f60c6f41d9df80810d46f668cb63a1
BLAKE2b-256 checksum
How to use checksums
f4f8e776bbaa82610d759651e9a3106827f7499b3891e44dcd9fecce2c8c0a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release files / simplesockets-0.4.0-py3-none-any.whl

Download URL simplesockets-0.4.0-py3-none-any.whl
Size 50.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75fa6dd42cb5f383b8449ec9273b8192647b1628f88421e0b71d553dac517ae1
BLAKE2b-256 checksum
How to use checksums
10c81ef31afed711d1742beb1f6034cabf5ff62de45d96709c887e8a7668a231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page