(Sorry; forgot to reply-to-all; forwarding to the racket-users list as well)
---------- Forwarded message ---------- From: Danny Yoo <d...@cs.wpi.edu> Date: Thu, Aug 18, 2011 at 2:00 PM Subject: Re: [racket] Using get-pure-port To: Shogo Yamazaki <moquo2....@gmail.com> On Thu, Aug 18, 2011 at 11:45 AM, Shogo Yamazaki <moquo2....@gmail.com> wrote: > Hi, > > I have a question about using get/post-pure-port. > I'm using Racket v5.1.2.3 and FreeBSD 8.2. > It seems tcp-port is still opened after I used get-pure-port. > How can I close this? The code is below. [code omitted] Hmm... Do you see the same issue if you use a Racket custodian to clean up the resources? The Systems tutorial talks about custodians a bit: http://docs.racket-lang.org/more/index.html#(part._.Terminating_.Connections) Your code would't have to change too much: it'd look something like: (define cust (make-custodian)) (parameterize ([current-custodian cust]) ;; .. your code, which opens ports and does other stuff (custodian-shutdown-all cust)) If you open ports in the context of a custodian, that custodian takes responsibility for cleaning up resources when custodian-shutdown-all gets called. _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users