With it's presence in the micro-controller dimension and the possibility
to run the same dialect on *nixens too, I thought it may or may not make
sense to give it a chance again.
-----------------------------------8<-----------------------------------
$ micropython -c 'import sys ; print(sys.implementation)'
(name='micropython', version=(1, 21, 0), _machine='linux [GCC 10.2.1] version', _mpy=2310)
$ cat socket-0.py
import socket
s=socket.socket() ai=socket.getaddrinfo('news.tilde.club',119,socket.AF_INET)[0][-1]
s.connect(ai)
line=s.readline()
messageId="<ul9sfr$isuf$
1@tilde.club>"
s.write(f"ARTICLE {messageId}\r\n")
line=s.readline()
while True:
line=s.readline()
if line==b".\r\n": break
print(line.decode("UTF-8"),end="") # look for coding in headers someday
s.write("QUIT\r\n")
s.write(".\r\n")
$ micropython socket-0.py | awk 'NR<9'
Path: news.tilde.club!.POSTED.149.27.127.112!not-for-mail
From: vort3 <
vort3@tilde.club>
Newsgroups: tilde.python
Subject: Anyone interested in writing a NNTP client in Python?
Date: Tue, 12 Dec 2023 20:59:09 +0600
Organization: tilde.club
Sender:
vort3@tilde.club
Message-ID: <ul9sfr$isuf$
1@tilde.club>
$ _
----------------------------------->8-----------------------------------
It took a while to grok that the errors it did throw were because it
preferred to resolve host names to IPV6 addresses and to find how to
switch that off. How to make µPy on *nixens handle IPV6 is currently
not in the upper range of my to do list, but maybe I stumble over an
answer while looking for different things.
I had some surprises with µPy earlier: It can be surprisingly fast.[0] ____________
[0]: <
https://yeti.tilde.institute/brain/micropython.html#emitters>
--
1. Hitchhiker 25: (59) Scarcely pausing for breath, Vroomfondel shouted,
"We don't demand solid facts! What we demand is a total absence of
solid facts. I demand that I may or may not be Vroomfondel!"
--- Synchronet 3.19a-Linux NewsLink 1.113