3 ;; server for client/server demo
7 ;; Start the client programm in a different
8 ;; terminal window or on a different computer
9 ;; See the 'client' file for more info.
14 (define (net-server-accept listenSocket)
16 (set 'connect (net-accept listenSocket))
17 (net-send connect "Connected!\n")
18 (while (net-server-receive connect)))))
20 (define (net-server-receive socket , str)
21 (net-receive socket 'str 256)
22 (print "received:" str "\n")
25 (net-send socket "bye bye!")
26 (net-close socket) nil)
27 (net-send socket (upper-case str))))
30 (if (not (set 'socket (net-listen 1111)))
31 (print "Listen failed:\n" (net-error))
34 (print "\nServer started\n")
35 (net-server-accept socket)