chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Is there a way to get tcp-accept to time-out?


From: Ed Watkeys
Subject: Re: [Chicken-users] Is there a way to get tcp-accept to time-out?
Date: Fri, 25 Feb 2005 08:26:52 -0500


On Feb 24, 2005, at 11:01 PM, Julian Morrison wrote:

Ed Watkeys wrote:

Hi all,

Anyone know of a way to get tcp-accept to time-out? Or, barring that, is there a way I can get a file descriptor from a listener so I can call file-select with it?

Will this help:

That should work very well. You should get Felix to put it in the distribution somewhere. That said, it still bothers me that I can't write this Posix-ly as I would in C with select(2). Here's the code I wrote in Guile to accomplish what I'm talking about:

(define (accept2 l . timeout)
  (let* ((timeout (if (null? timeout) #f (car timeout)))
         (fds-list (select (vector l) #() #() timeout))
         (read-fds (car (fds-list))))
    (if (null? read-fds)
        #f
        (accept l))))

Regards,
Ed





reply via email to

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