picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

net.l (567B)


      1 # 10jun11abu
      2 # (c) Software Lab. Alexander Burger
      3 
      4 ### port listen connect ###
      5 (test '(a b c)
      6    (let P (port 0 "ListenPort")
      7       (if (fork)
      8          (prog1
      9             (in (listen P) (rd))
     10             (close P) )
     11          (close P)
     12          (wait 400)
     13          (and (connect "localhost" "ListenPort") (out @ (pr '(a b c))))
     14          (bye) ) ) )
     15 
     16 
     17 ### udp ###
     18 (test '(a b c)
     19    (let P (port T 0 "UdpPort")
     20       (if (fork)
     21          (udp P)
     22          (close P)
     23          (wait 400)
     24          (udp "localhost" "UdpPort" '(a b c))
     25          (bye) ) ) )
     26 
     27 # vi:et:ts=3:sw=3