[Top][All Lists]

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

[MIT-Scheme-users] Simple Client/Server

From: Matt Birkholz
Subject: [MIT-Scheme-users] Simple Client/Server
Date: Mon, 27 Apr 2009 10:31:02 -0700

> From: Amit Saha <address@hidden>
> Date: Mon, 27 Apr 2009 21:02:40 +0530
> [...]
> (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)
>    )
> [...]
> Isn't the 'read-line' correct way to do it?

I guess.  You intend to echo one line and disconnect?  Don't feel like
closing the connection explicitly?

> [...]
> Anything else I am missing?

I cannot miss the "((let" in line 2.  I rarely see that in code --
only when someone has a short (let ...) snippet that looks up a
procedure (for a fancy dispatch).  My paren flasher suggests you are
passing it zero arguments.  You don't get an error message before the
disconnect, about a bogus value that should be a procedure?

reply via email to

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