mit-scheme-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-users] Simple Client/Server


From: Amit Saha
Subject: [MIT-Scheme-users] Simple Client/Server
Date: Mon, 27 Apr 2009 21:02:40 +0530

Hi all,

I am trying to implement a simple echo server, like this:

<code>
(define (start-server service)
   ((let ((server-sock (open-tcp-server-socket service)))
      (display "Server ready to accept connections..")
      (newline)
      (let ((from-client (read-line (tcp-server-connection-accept
server-sock #t #f))))
            (display from-client))))
   (close-tcp-server-socket server-sock)
   )
</code>

The server starts alright and I can also connect a client to the port
on which I start the server- either a Scheme client or a 'telnet'
client. But for some reason, I cannot get the text that I send to the
server.

Isn't the 'read-line' correct way to do it?

Anything else I am missing?

Thanks,
Amit

-- 
http://amitksaha.blogspot.com
http://amitsaha.in.googlepages.com/
*Bangalore Open Java Users Group*:http:www.bojug.in

"Recursion is the basic iteration mechanism in Scheme"
--- http://c2.com/cgi/wiki?TailRecursion




reply via email to

[Prev in Thread] Current Thread [Next in Thread]