File transfer example

pull/4/head
Mark Qvist 2018-04-25 22:46:05 +02:00
rodzic 4d48a50f7e
commit 8aa2f8613a
3 zmienionych plików z 13 dodań i 5 usunięć

Wyświetl plik

@ -86,8 +86,10 @@ def client_connected(link):
# We pack a list of files for sending in a packet
data = umsgpack.packb(list_files())
RNS.log(str(len(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
# send it as a single packet over the link.
list_packet = RNS.Packet(link, data)

Wyświetl plik

@ -39,7 +39,7 @@ class Packet:
# This is used to calculate allowable
# payload sizes
HEADER_MAXSIZE = 23
HEADER_MAXSIZE = RNS.Reticulum.HEADER_MAXSIZE
# TODO: This should be calculated
# more intelligently

Wyświetl plik

@ -1,6 +1,7 @@
from Interfaces import *
import ConfigParser
from vendor.configobj import ConfigObj
import RNS
import atexit
import struct
import array
@ -11,9 +12,14 @@ import RNS
#import traceback
class Reticulum:
MTU = 500
router = None
config = None
MTU = 500
HEADER_MAXSIZE = 23
PAD_AES_HMAC = 64
MDU = MTU - HEADER_MAXSIZE
LINK_MDU = MDU - PAD_AES_HMAC
router = None
config = None
configdir = os.path.expanduser("~")+"/.reticulum"
configpath = ""