3 ; test local domain UNIX sockets
5 (define (listener path)
6 (set 'lsock (net-listen path))
7 (set 'csock (net-accept lsock))
8 (net-receive csock 'buff 1024)
9 (net-send csock (upper-case buff))
14 (set 'pid (fork (listener "/tmp/mysock")))
17 (while (not (set 'conn (net-connect "/tmp/mysock")))
22 (println "Could not connect")
24 (println "net-peer: " (net-peer conn))
25 (println "net-local: " (net-local conn))
26 (net-send conn "hello world")
28 (while (not (net-select conn "read" 1000))
29 (println "waiting with net-select ..."))
31 (println "net-peek: " (net-peek conn))
33 (net-receive conn 'buff 1024)
34 (if (= "HELLO WORLD" buff)
36 (prrintn buff ": Error"))