chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] tcp-connect open ports problem


From: Matt Jones
Subject: [Chicken-users] tcp-connect open ports problem
Date: Sun, 05 Apr 2009 15:03:36 +0100
User-agent: Thunderbird 1.5.0.14pre (X11/20071022)

Hi folks,

I'm having an issue with the tcp-connect function. When it fails to connect, it seems not to clean up properly, so that I end up with lots of open ports.

Try this code:

  (require-extension tcp)

  (define (error-info e)
    ((condition-property-accessor 'exn 'message) e))

  (define (test-tcp-connect)
    (condition-case
      (tcp-connect "localhost" 8000)
      (e (exn i/o net) (print (error-info e)))))

assuming there is nothing on port 8000.  Then,

  (let loop ((i 0)) (when (< i 2000) (test-tcp-connect) (loop (+ i 1))))

I get,

  can not create socket - Connection refused
  can not create socket - Connection refused
  ...
  can not create socket - Too many open files
  can not create socket - Too many open files
  ...

I'm using Version 2.731 - linux-unix-gnu-x86. Is this a bug, or is there some way for me to release these ports when I handle the exception?

Thanks!
Matt




reply via email to

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