🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13909

Re: Converting Socket to NonBlocking

#13909
From: Peter Str�mberg
Date: Mon, 08 Sep 2003 09:31
33 lines
2274 bytes
"Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> wrote in
news:3f5afae1$3@newsgroups.borland.com: 

> "Dumboo" <dumboo@nowhere.com> wrote in message
> news:3f5aef07$1@newsgroups.borland.com...
> 
>> i have created a small server(using RAW BSD Socket API), which is by
>> default in Blocking mode, i want to convert it to a non-blocking mode
>> using only BSD Socket API's so that the server is portable across
>> platoforms, is it possible ? 
> 
> As far as I know, non-blocking sockets are a Microsoft Windows
> construct, they are based on HWND windows and posting window message
> notifications. Other platforms use just blocking sockets.
> 
> With that said, under MSWindows/WinSock at least, non-blocking sockets
> are enabled using ioctlsocket(FIONBIO) and then utilizing the various
> WSA...() functions introduced in WinSock for asynchronous socket
> operations, such as WSAAsyncGetHostByName(), WSAAsyncSelect(), etc. in
> addition to the standard socket functions such as socket(), connect(),
> listen(), etc.  I do not know whether FIONBIO or the WSA...()
> functions are available under other platforms besides MSWindows.

FIONBIO (and non-blocking i/o) is available on all unices

    	int one = 1;
    	ioctl(fd, FIONBIO, &one); 

WSA...() however, is for Windows only.

-- 
Peter Str�mberg
C2K2 C2K3 ISCCIV02
Technical Details
Message-ID: <Xns93F075322794Bwilfriedspamcopnet@207.105.83.65>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news-xfer1.atl.newshosting.com!63.218.45.11.MISMATCH!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f5aef07$1@newsgroups.borland.com> <3f5afae1$3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,e15b5507c670aacd
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-08 02:38:07 PST
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Converting Socket to NonBlocking
From: "Peter Str�mberg" <wilfried@spamcop.net>
References: <3f5aef07$1@newsgroups.borland.com> <3f5afae1$3@newsgroups.borland.com>
Message-ID: <Xns93F075322794Bwilfriedspamcopnet@207.105.83.65>
User-Agent: Xnews/05.08.12
NNTP-Posting-Host: 194.71.160.182
Date: 8 Sep 2003 02:31:14 -0700
X-Trace: newsgroups.borland.com 1063013474 194.71.160.182 (8 Sep 2003 02:31:14 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news-xfer1.atl.newshosting.com!63.218.45.11.MISMATCH!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail