mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-22 13:40:19 +00:00
File transfer example
This commit is contained in:
parent
4d48a50f7e
commit
8aa2f8613a
@ -86,8 +86,10 @@ def client_connected(link):
|
|||||||
# We pack a list of files for sending in a packet
|
# We pack a list of files for sending in a packet
|
||||||
data = umsgpack.packb(list_files())
|
data = umsgpack.packb(list_files())
|
||||||
|
|
||||||
|
RNS.log(str(len(data)))
|
||||||
|
|
||||||
# Check the size of the packed data
|
# Check the size of the packed data
|
||||||
if len(data) <= RNS.Resource.SDU:
|
if len(data) <= RNS.Reticulum.LINK_MDU:
|
||||||
# If it fits in one packet, we will just
|
# If it fits in one packet, we will just
|
||||||
# send it as a single packet over the link.
|
# send it as a single packet over the link.
|
||||||
list_packet = RNS.Packet(link, data)
|
list_packet = RNS.Packet(link, data)
|
||||||
|
@ -39,7 +39,7 @@ class Packet:
|
|||||||
|
|
||||||
# This is used to calculate allowable
|
# This is used to calculate allowable
|
||||||
# payload sizes
|
# payload sizes
|
||||||
HEADER_MAXSIZE = 23
|
HEADER_MAXSIZE = RNS.Reticulum.HEADER_MAXSIZE
|
||||||
|
|
||||||
# TODO: This should be calculated
|
# TODO: This should be calculated
|
||||||
# more intelligently
|
# more intelligently
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from Interfaces import *
|
from Interfaces import *
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
from vendor.configobj import ConfigObj
|
from vendor.configobj import ConfigObj
|
||||||
|
import RNS
|
||||||
import atexit
|
import atexit
|
||||||
import struct
|
import struct
|
||||||
import array
|
import array
|
||||||
@ -11,9 +12,14 @@ import RNS
|
|||||||
#import traceback
|
#import traceback
|
||||||
|
|
||||||
class Reticulum:
|
class Reticulum:
|
||||||
MTU = 500
|
MTU = 500
|
||||||
router = None
|
HEADER_MAXSIZE = 23
|
||||||
config = None
|
|
||||||
|
PAD_AES_HMAC = 64
|
||||||
|
MDU = MTU - HEADER_MAXSIZE
|
||||||
|
LINK_MDU = MDU - PAD_AES_HMAC
|
||||||
|
router = None
|
||||||
|
config = None
|
||||||
|
|
||||||
configdir = os.path.expanduser("~")+"/.reticulum"
|
configdir = os.path.expanduser("~")+"/.reticulum"
|
||||||
configpath = ""
|
configpath = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user