On Mon, Apr 27, 2009 at 11:01 PM, Matt Birkholz
<[email protected]> wrote:
>> From: Amit Saha <[email protected]>
>> 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?
I don;t think I get what you say.. What I am trying to do is to write
a server which will simply echo back whatever is sent to it by the
connected client.
>
>> [...]
>> 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?
No error message or bogus value. There was one extra '(' in ((let.. .
I have removed it..
The server remains alive and I can connect as many clients I want to
and the connections are all established fine.
I am guessing that its a problem with reading of the data.
Best,
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
_______________________________________________
MIT-Scheme-users mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/mit-scheme-users