Skip to main content

A library that makes it easy to make multiplayer

Project description

Multisocket

A library that handles all of the socket backend, While you can focus on making your application.

It's easy to set it up, Just make a Server (multisocket.server.Server) and some Clients (multisocket.client.Client), Start the server, And connect the clients to the server.

You can give the client or the server a callback function, So that you can change their behaviour!

If you give the client a callback function, It will be called every frame and be given these arguments.

client - The client that called this function. packets - All of the packets that the client recieved from the server, In a list.

This callback function can return a single packet, Or a list of them, And the client will send them to the server.

Similarly, If you give the server a callback function, It will also be called every frame, And get these arguments.

server - The server that called this function. client - The client that the packets will be sent to. packets - All of the packets that the server recieved from the client, In a list.

This callback function can also return packets to send to the client.

This is a simple script that uses multisocket to communicate between servers and clients:

from multisocketing import clients, servers
from multisocketing import packets as packetClasses
import threading

def clientLoop(client, packets):
    print("packets from server:")
    print(packets)
    return packetClasses.Packet()

def serverLoop(server, client, packets):
    print("packets from client:")
    print(packets)

def setupServer():
    s = servers.Server(serverLoop)
    s.start()

def makeClient():
    c = clients.Client(clientLoop)
    c.connect()

thread = threading.Thread(target=setupServer)
thread.start()

thread = threading.Thread(target=makeClient)
thread.start()

makeClient()

Hope this library makes it easier for you to make socket-related applications!

(Seems like I had to re-build this 3 times just to fix the README...)

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

multisocketing-1.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

multisocketing-1.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file multisocketing-1.3.tar.gz.

File metadata

  • Download URL: multisocketing-1.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for multisocketing-1.3.tar.gz
Algorithm Hash digest
SHA256 20f4004575166fadc955c33152f6352a1a63e63f0e79b0d6ad4b4a823fafd63e
MD5 2b3281ce8c072c0a247b3a99ec962c06
BLAKE2b-256 9852920f92bbdecd77705e2600ea763fff24e46a7e5d9e52f7baa01341e31658

See more details on using hashes here.

File details

Details for the file multisocketing-1.3-py3-none-any.whl.

File metadata

  • Download URL: multisocketing-1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for multisocketing-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7f23a95da5c324888155b09cc4ffb94f292dc62b3bb1c63be5e8fc476480ca0d
MD5 e14da1f209549299deb49196abbd624c
BLAKE2b-256 d8778d793e3a9f590cd2d699cda8b99c77ed71cf049374e49b481b4333062f83

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