Skip to main content

Protocol to provide fast and light communication between devices over (W)LAN

Project description

UltraSockets

Quasi-Application layer protocol to provide fast and light communication between devices on (W)LAN. It's built to facilitate "casual" data transfer between devices such as laptops and microcontrollers. It is easier and faster to develop compared to TCP, while not having as high of an overhead and baggage as HTTP.

Features:

1. Full-duplex communication with fully-automated threading to enable it

2. Supports efficient multiple client-client communication

3. Has a user-friendly handshake layer which can be modified to provide encryption and compression

Installation

This project is compatible with all versions of Python 3.

Run this to install the package:

pip install ultra-sockets

Documentation

This is a very brief documentation of UltraSockets. The package was meant to be easy to use and understand from the very beginning, so this hopefully shouldn't be too confusing. Most of the technical details of TCP should be taken care of, so that even for beginners the package can be usable

The Client

This is the individual unit of the UltraSockets system. It is a computer which is connected to the communications network.

client = Client(hostname,name)
  • Hostname will be the IP of the host/server and the port. "192.168.x.xxx:8000" for example, where 8000 is the port.

  • Name is the name given to the client. This is just a string like "PC2" which is used to refer to the client when messages are sent.

client.get(num)
  • Num can be the number of messages that you want to retrieve from the Queue which contains all the messages recieved so far. If no messages are present, it returns None. It operates as First In, Last Out. It will return a list like so:

    [ [ name_of_recipient , message , message_serial_number ] , [...] , ... ]

  • Num can also be "all" which will return a list of all the messages that have been recieved

client.send(name, message)
  • The name is the name of the recipient who the messsage is going to be sent to,

  • Message is the message itself which is going to be transmitted. It can be any data type

client.close()
  • It will temporarily close the thread which is used for recieving messages. This means the client can no longer recieve messages. One use case is when an intensive task is being performed, so the client wants to only have the main thread running to maximize efficiency
client.open()
  • It will reopen the message collecting thread that has been closed. Now the client can recieve messages again.
client.terminate()
  • This will permanently close the message recieving thread. It lets the client cleanly exit out of the network after they are done.

The Server

The Server object is the host computer. However, it is not really a "host" anymore due to the message routing that takes place under UltraSockets. While it is a server at a technical level, the user will not be able to tell the difference between it, and any other client.

server = Server(hostname,connections,name)
  • This will create the server object.

  • Hostname will be the IP of the host and the port. In this case the server is the host, so your own IP address will be entered as a string."192.168.x.xxx:8000" for example, where 8000 is the port.

  • Port is the port on which communications will take place. It will be a number like 8000.

  • Connections is the number of connections supported by the server. It is the number of clients that can connect to the server. This must be exactly equal to the number of clients that will join - no more or no less.

  • Name is the name given to the server computer. This is just a string like "PC1" which is used to refer to the server

server.send(name, message)
  • The name is the name of the recipient who the messsage is going to be sent to,

  • Message is the message itself which is going to be transmitted. It can be any data type

server.get(num)
  • Num can be the number of messages that you want to retrieve from the Queue which contains all the messages recieved so far. If no messages are present, it returns None. It operates as First In, Last Out. It will return a list like so:

    [ [ name_of_recipient , message , message_serial_number ] , [...] , ... ]

  • Num can also be "all" which will return a list of all the messages that have been recieved

Support

If you are having issues, please let me know. You can contact me at mugi.ganesan@gmail.com

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

ultra_sockets-1.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ultra_sockets-1.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file ultra_sockets-1.0.2.tar.gz.

File metadata

  • Download URL: ultra_sockets-1.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for ultra_sockets-1.0.2.tar.gz
Algorithm Hash digest
SHA256 38d09bff218068ace6680ecf2706634c0173d077a999a37aeb32e400cd0b5d78
MD5 920ef842528b3ce313c17b49e6e38a5f
BLAKE2b-256 a6ab39004ff3e760ff688bbf7249ad4a3c3586fa9493d51b875ffee8cf7294c4

See more details on using hashes here.

File details

Details for the file ultra_sockets-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: ultra_sockets-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

File hashes

Hashes for ultra_sockets-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86701a1f446051664f9998438f9933d2fff0c31343e11295e2c8c0f318f9d770
MD5 5a3aaa57fc70c2701ca921718c7a8c27
BLAKE2b-256 bdf64a9c5098c3bbcc7525c783d2cbcbf9fce289f5d307a834fdb8475ce113b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page