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

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

Re: [MIT-Scheme-users] Simple Client/Server


From: Amit Saha
Subject: Re: [MIT-Scheme-users] Simple Client/Server
Date: Mon, 27 Apr 2009 23:31:52 +0530

On Mon, Apr 27, 2009 at 11:01 PM, Matt Birkholz
<address@hidden> wrote:
>> 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?

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




reply via email to

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