cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: non-blocking sockets portability test

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Sep 2001 16:55:40 +0200 (MET DST)

On Wed, 26 Sep 2001, Janne Johansson wrote:

> It wouldn't auto-build under openbsd-m68k at least. 8-(

> cc -O2 -o connect connect.c
> connect.c:7: stropts.h: No such file or directory
> *** Error code 1
>
> After removing the include for stropts.h, it built

Yes, that one was left there by accident. Neither Solaris nor Linux need
that, but they both survive as it is present on both systems.

> but says this:

> bash-2.05# make test
> ./connect www.haxx.se
> Non-blocking socket set
> connect() returned -1
> select() returned 1
> returned 0
> *** Error code 11

Believe it or not, but that's what it was supposed to say when successful!
;-)

I didn't bother to spend time to make any beautiful responses. The connect()
returns -1 when a non-blocked connect is being performed, select() returns 1
when the connect has succeeded and the 'returned 0' means fine. The "Error
code 11" is just because my main() is nasty enough to not return anything so
that gets a random return value... :-)

So far, we have it successfully tested on:

 OS Method

 OpenBSD 3.0 GENERIC#10 i386 O_NONBLOCK
 openbsd-m68k O_NONBLOCK
 SunOS 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-250 O_NONBLOCK
 Linux 2.4.10 O_NONBLOCK

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-09-26