Broken server
Posted: Thu Apr 14, 2005 6:43 pm
I got a server that will accept one client but exits right after the client closes the connection. I want to keep the server listening and ready to accept so that other clients (or the same one) can communicate with the server more than once.
Anyone got an idea why this would be?
-statik
Code: Select all
(define (server)
(set 'addr "localhost")
(set 'port 100)
(set 'listen (net-listen port addr))
(println "Waiting for connection on: " port)
(set 'socket (net-accept listen))
(println "Accepting... ")
(if socket
(while (net-receive socket 'received 1024)
(println "I got something: " (string received))
(net-send socket (string received)
)
)
)
-statik