Browse Source

Examples and basic README.md added

master
Stephen Downward 2 years ago
parent
commit
bd2f52b672
3 changed files with 67 additions and 0 deletions
  1. +24
    -0
      README.md
  2. +20
    -0
      examples/example_client.py
  3. +23
    -0
      examples/example_server.py

+ 24
- 0
README.md View File

@@ -0,0 +1,24 @@
# AX26

This is meant to be a successor to the AX25 protocol. It has many advantages:

* Unlimited data sizes (Broken up into smaller packets seamlessly)

* Configurable packet sizes

* Built in compression (Level 9 gzip)

* IDs that are basically limitless (Up to the size of the packet)

* Error correction (MD5)

The library is very WIP and should not be used in production. Classes and functions are subject to change.


There is a client and a server class. The client is made to connect to the server, and the server will accept connections from as many clients as you want, spawning a new thread for each.
Please look at the example code for more information.


TODO:

- License

+ 20
- 0
examples/example_client.py View File

@@ -0,0 +1,20 @@
import time
import kiss2
import ax26

k = kiss2.TCPKISS(host='localhost', port=8001)
k.start()

x = ax26.Client(k, "CLIENT_CALLSIGN-SSID") # The client's SSID
x.connect("SERVER_CALLSIGN-SSID") # The server's SSID

data_to_send = b'Hello server, this is client!' # Notice that this is a byte array
start = time.time()
x.send_data(data_to_send)
print("SENT " + str(len(data_to_send)) + "BYTES IN " + str(time.time() - start) + " SECONDS")
while True:
r = x.receive_data() # Wait for data from server and then exit
if r is not None:
print(r)
x.disconnect()
break

+ 23
- 0
examples/example_server.py View File

@@ -0,0 +1,23 @@
import kiss

import ax26

k = kiss.TCPKISS(host='localhost', port=8001)
k.start()

x = ax26.Server(k, "SERVER_CALLSIGN-SSID") # The server's SSID

class handler:
def __init__(self, client_call):
print(b"New connection from " + client_call)
self.their_callsign = client_call

def on_recv(self, data):
print (data)
x.send_data(self.their_callsign, b"Data received. Here is a reply!")

def on_disconnect(self):
print(self.their_callsign + b" disconnected")


x.serve_forever(handler)

Loading…
Cancel
Save