chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] udp.scm on cygwin


From: felix winkelmann
Subject: Re: [Chicken-users] udp.scm on cygwin
Date: Tue, 25 Oct 2005 07:22:49 +0200

On 10/23/05, Daishi Kato <address@hidden> wrote:
> Hi,
>
> I found a relevant entry at;
> http://www.cygwin.com/ml/cygwin/2002-11/msg00732.html
> and it is actually noted in recvfrom(2).
>
> I did make a patch which works fine for me,
> but let me know if there is a better way of fixing,
> like using foreign-something.
>

Your patch is word-size and endian-specific, I suggest something like this:

(define udp-recvfrom
  (lambda (sock len)
    (let ((fd (io:descriptor sock))
          (buf (make-string len))
          (from (make-string _sockaddr_in_size)))
      (let-location ((fromlen int _sockaddr_in_size))
        (let ((result
               (restart-nonblocking "recvfrom" fd #t
                                    (lambda () (##net#recvfrom fd buf len
                                                               0 from 
#$fromlen)))))
          (values result (substring buf 0 result)
                  (##net#inaddr->string from) (##net#inaddr-port from)))))) )

> Next in my wish list for udp.scm is
> the support of native-windows.
> I will try to setup an environment, but it seems there are several methods:
> vcbuild.bat, makefile.vc, cmake, and maybe cygwin+mingw.
> For now, which is the best to go?
>

It depends on your available tools. I recommend the native toolset.
Depending on whether you have the commercial version or not,
you should use either makefile.vc or vcbuilt.bat/vctk-install.txt.


cheers,
felix




reply via email to

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