Skip to main content

A small Server and Client creator

Project description

This is a little library for creating Servers and Clients to send data.

Usage:

ClientStream:

myclient = Clientstream(addr, port) #Generate

myclient.connect() #Connect

myclient.setListener("connect", connect) #Replace the second argument with a function. Overgiving args:

myclient.setListener("disconnect", disconnect) #Replace the second argument with a function. Overgiving args:

myclient.setListener("recv", recv) #Replace the second argument with a function. Overgiving args: None, data

myclient.setListener("recvexception", recv) #Replace the second argument with a function. Overgiving args: exception

myclient.send("something", delay) #Send; delay is by default 300 ms

myclient.pause() #Pause

myclient.unpause() #Unpause

is_paused = myclient.getpaused() #Getpaused

myclient.stop() #Stop

ServerStream:

myserver = Serverstream(addr, port, maxclients) #Generate

myserver.connect() #Connect

myserver.setListener("connect", connect) #Replace the second argument with a function. Overgiving args: sock_id

myserver.setListener("disconnect", disconnect) #Replace the second argument with a function. Overgiving args: sock_id

myserver.setListener("recv", recv) #Replace the second argument with a function. Overgiving args: sock, data

myserver.setListener("recvexception", recv) #Replace the second argument with a function. Overgiving args: exception

myserver.send(sock_id "something", delay) #Send to sock_id; delay is by default 300 ms

myserver.pause() #Pause

myserver.unpause() #Unpause

is_paused = myserver.getpaused() #Getpaused

myserver.stop() #Stop

Packet: There are 3 default types of Packets. The JSON, pickle and repr Packet. In this case, we use a JSONPacket to show it: mypacket = JSONPACKET(data) #Create; data is by default {} mypacket.set_data({"1":1, "2":2}) #Set print(mypacket.get_data()) #Getall print(mypacket.get_data("1")) #Get myclient.send(mypacket.pack()) #Send mypacket = JSONPacket.unpack(raw_data)

to create an own Packet, you must create this: class MyPacket(easystreaming.Packet): def pack(self): #return bytes of self.data def unpack(rdata): #return Packet with unpacked data

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

easystreaming-0.0.6.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

easystreaming-0.0.6.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file easystreaming-0.0.6.2.tar.gz.

File metadata

  • Download URL: easystreaming-0.0.6.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for easystreaming-0.0.6.2.tar.gz
Algorithm Hash digest
SHA256 ad3fe1ee90ad692613fa1537c51bc32ede43a561f7234ea773357a310444477b
MD5 4390130bf844cff634fc177b0bb69cc4
BLAKE2b-256 230a37795ffcfa6ee4aad212e9fd9a58413dce7dc7bf2a75b79820beea4840bc

See more details on using hashes here.

File details

Details for the file easystreaming-0.0.6.2-py3-none-any.whl.

File metadata

  • Download URL: easystreaming-0.0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3

File hashes

Hashes for easystreaming-0.0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 393fd052946685136808d11bc324e89159c0508df6a060629d7fe4a2acf7e349
MD5 17723aec701fda9ec2181601e2c88728
BLAKE2b-256 07c1a8431376c3de90ccba7f2f7e8b5e7e63bc02c44cb41dc7bd1beea9b61fe4

See more details on using hashes here.

Supported by

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