chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] How to convert an UDP socket to file descriptor


From: Peter Bex
Subject: Re: [Chicken-users] How to convert an UDP socket to file descriptor
Date: Thu, 29 Apr 2010 14:27:30 +0200
User-agent: Mutt/1.4.2.3i

On Thu, Apr 29, 2010 at 08:47:29AM -0300, Alexsandro Soares wrote:
> Hi Peter,
> 
>   I changed the line
>          (fd (port->fileno (udp-bound-port s)))
>   to
>          (fd (port->fileno port))
> 
>   But now, the error is
> 
>      Error: (port->fileno) argument is not a port: 6000

I also made the same mistake by not reading your code right.  What
you want seems to be impossible since the udp egg doesn't create Scheme
ports at all.  You could try this:

(define (udp-socket->fileno s) (and (udp-socket? s) (##sys#slot s 1)))

and then use that.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth




reply via email to

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