[Oberon] File transfer; was, "all in one git tree"
peter at easthope.ca
peter at easthope.ca
Thu Dec 31 21:20:54 CET 2020
Hi,
From: =?utf-8?Q?J=C3=B6rg_Straube?= <joerg.straube at iaeth.ch>
Date: Thu, 31 Dec 2020 12:52:51 +0100
> I transfer file to and from Oberon with tftp (RFC1350, tftp client
> on OberonOS, tftp server on other side).
TFTP client and server were also implemented in A2 by "be".
Modules TFTP.Mod (373 lines) and Oberon.TFTPTool.Mod (51 lines) are
visible.
https://en.wikibooks.org/wiki/Oberon/A2#Sources,_Tools_and_Configuration_Texts_in_A2
TFTP.Mod has "IMPORT IP, UDP, Files, Random, KernelLog;"
Random is used to find a vacant port.
generator: Random.Generator;
...
REPEAT
INC(retries); lport := 1024 + generator.Integer() MOD 64512;
NEW(socket, lport, res)
UNTIL (res # UDP.PortInUse) OR (retries > MaxSocketRetries);
According to
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
port 69 is assigned to TFTP. Why not use it?
An incremental search might be acceptable.
(* Find a vacant ephemeral port. *)
lport := 60000;
topPort := lport + MaxSocketTries;
(* Top ephemeral port is 64738. I don't understand the origin of 64512. *)
IF topPort > 64738 THEN topPort := 64738 END;
NEW(socket, lport, res);
WHILE(res = UDP.PortInUse) & (lport < topPort) DO
INC(lport);
NEW(socket, lport, res)
END;
A FPGA board connects to the server by a serial crossover cable.
Analogously for an emulated V5 machine.
In linux at least, a server is readily available.
https://wiki.debian.org/TFTP
Regards, ... P. L.
--
Tel: +1 604 670 0140 Bcc: peter at easthope. ca
More information about the Oberon
mailing list