Send data to the command line

The command line receives on a UDP port it binds. This waits for one packet, prints its payload, and exits (hosts/unix.o.se):

./o.se -f o.se.osen/osen.ose '/,/s/0.0.0.0' '/,/i/7788' '/!/udp/sock/bind' \
    '/!/udp/recv' '/!/drop' '/!/println' '/!/quit'

The /!/drop is there because /udp/recv pushes the payload and then the sender’s address, so the address is on top.

From the Python host’s prompt, with examples/udp.py loaded so the prompt has UDP verbs (osepy/host):

python3 -m ose.repl --load examples/udp.py
ose> /s : () /o/udp/sock/create
ose> (("ping from the ose prompt") /o/toblob/fromelem, "127.0.0.1", 7788, /s) /o/udp/sendto

The command line prints ping from the ose prompt and exits. The other direction: python3 examples/udp.py --serve 7777 answers what the command line sends it with '/,/s/hello from the CLI' '/,/s/127.0.0.1' '/,/i/7777' '/!/udp/sock/create' '/!/udp/sendto'.


Examples · Between hosts