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 multisocket import client, server, packet
import threading

def serverCallback(server, client, packets):
    print("Packets from client:")
    print(packets)
    return packet.Packet()

def clientCallback(client, packets):
    print("Packets from server:")
    print(packets)
    return packet.Packet()

c = client.Client(clientCallback)
s = server.Server(serverCallback, "127.0.0.1", 5000)

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

c.connect("127.0.0.1", 5000)

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

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.1.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.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: multisocketing-1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3dcec18a508d30d33363831a4ab90c40f37263e9834965623e118efa3ed76ad8
MD5 9f38e9883391eeaad90d20138d258b2f
BLAKE2b-256 9b519da396d2cadef23c56989e1ba569dd3b3db64b73d5371c2fb32752a23b0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multisocketing-1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef51e55ff5c58902a8104fb5a592f5ad01a21a0239186599894113f40ce5169
MD5 a26edca1ad4a2edb09ffbbaa81851f08
BLAKE2b-256 365c99a0a60528549fbf83cd8e857c9c3300c6be02a09705abc4e2f32c534d51

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