3 ;; client for client/server demo
5 ;; USAGE: client hostName
7 ;; 'hostName' contains a string with the name or IP number
8 ;; of the computer running the server application
10 ;; The client prompts for input and sends it to the
11 ;; server which sends it back converted to uppercase
13 ;; The server has to be started first in a different
14 ;; terminal window or on a different computer.
19 (define (net-client-receive socket , buf)
20 (net-receive socket 'buf 256)
21 (print "\n" buf "\ninput:")
22 (if (= buf "bye bye!") (exit))
23 (net-send socket (read-line)))
25 (define (client host-computer)
26 (set 'socket (net-connect host-computer 1111))
28 (print "could not connect, is the server started?\n")
29 (while true (net-client-receive socket))))
31 (if (not (main-args 2))
33 (print "USAGE: client hostName\n")
36 (client (main-args 2))