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

Uploaded Python 3

File details

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

File metadata

  • Download URL: multisocketing-1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a42fb01b2a4af9bad6cddbdb8cbce9a44539563f169c7b975d7aa813e95bfc0e
MD5 0fe758945263a15a3aab3f5cfabdfac3
BLAKE2b-256 f8d4eaacad84c2aec6157bf61256eb56399ad9d6706364932264acaef26a96f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multisocketing-1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a63ce4aacef3f945dd187953de2a4ee647d114a048a5fe80902f22908e4fbcba
MD5 72e311ad38015186a5c8a585be927213
BLAKE2b-256 7048c715e9e4875ce450a513517fad284b97e8e2fedb50ec0f687bfdb9a66af4

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