Skip to content
Patrick Hammer edited this page Jan 18, 2022 · 14 revisions

Start the UDPNAR with:

./NAR UDPNAR IP PORT timestep(ns per cycle) printDerivations
./NAR UDPNAR 127.0.0.1 50000 100000 true

Now any client can send Narsese to this instance.

Examples:

Python:

import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def NAR_AddInput(input):
    sock.sendto((input+'\0').encode(), ("127.0.0.1", 50000))

NAR_AddInput("<a --> b>. :|:")

Bash:

NAR_AddInput.sh:

printf "$1\0" | nc -w 1 -u 127.0.0.1 50000 &

Example.sh:

sh NAR_AddInput.sh '<a --> b>. :|:'

Full UDP input and output

Start output server to display ONA output:

nc -ul 127.0.0.1 -p 50001

Start ONA server with redirection to output server:

./NAR UDPNAR 127.0.0.1 50000 100000 true | nc -w 1 -u 127.0.0.1 50001

Start shell client for input:

nc -w 1 -u 127.0.0.1 50000

Clone this wiki locally