chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] threaded TCP server


From: felix winkelmann
Subject: Re: [Chicken-users] threaded TCP server
Date: Mon, 30 Jul 2007 08:43:10 +0200

On 7/28/07, Shawn Rutledge <address@hidden> wrote:
>
> When I type (exit) into the telnet session, I get errors like this on
> the server side:
>
> Warning (#<thread: thread6>): : port already closed: #<output port (tcp)>
>
>         Call history:
>
>         <eval>          (environment-copy (scheme-report-environment 5) #t)
>         <eval>          (scheme-report-environment 5)
>         <eval>          (environment-extend! env (quote exit) (lambda
> () (close-output-port o) (close-input-port i)))
>         <eval>          (write-line "; dsinpd 0.0.1" o)
>         <eval>          ((letrec ((reploop (##core#loop-lambda () (pp
> (eval (read i) env) o) (reploop)))) reploop))
>         <eval>          (pp (eval (read i) env) o)
>         <eval>          (eval (read i) env)
>         <eval>          (read i)
>         <syntax>                (exit)
>         <eval>          (exit)
>         <eval>          (close-output-port o)
>         <eval>          (close-input-port i)    <--
>
>
> But it is necessary to close both ports, otherwise the client is not
> disconnected.  The example server.scm on the wiki does not act like
> this; so I think it must have to do with the combination of tcp and
> lightweight threads.

The backtrace is misleading: what fails is the "(pp ... o)" on a closed
port (closed by evaluating the "(exit)"). This should actually show up
in the error message. Do you run this test in the interpreter or do you
compile it?


cheers,
felix




reply via email to

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