Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.sgi.com!www.nntp.primenet.com!nntp.primenet.com!swrinde!cs.utexas.edu!news.sprintlink.net!news-peer.sprintlink.net!uunet!news-in2.uu.net!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!dispatch.news.demon.net!demon!tarrant.microlise.co.uk!news From: andrewg@microlise.co.uk (Andrew Gierth) Newsgroups: comp.unix.bsd,comp.unix.programmer,comp.unix.questions Subject: Re: Asynchronous and nonblocking Date: 27 Sep 1996 02:33:59 +0100 Organization: Microlise Engineering Ltd. Lines: 39 Message-ID: <uf7mpgn3ll.fsf@zen.microlise.co.uk> References: <3247E071.35C8@cod.nosc.mil> NNTP-Posting-Host: zen.microlise.co.uk X-NNTP-Posting-Host: microl.demon.co.uk In-reply-to: Grace Huynh's message of Tue, 24 Sep 1996 13:31:16 GMT X-Attribution: AG X-Mayan-Date: Long count = 12.19.3.9.9; tzolkin = 1 Muluc; haab = 12 Chen X-Geek: (V3.1) GCS/IT/CC d-(pu) s:+> a- C++++$ UACHV++++$ P--- L E++ W(--) N+++ o? K? w--- O+++ M- V-- PS+ PE Y+(--) PGP- t+@ 5+++ X R@ tv(-) b++ DI? !D G++ e h* !r y Cc: Grace Huynh <gpham@cod.nosc.mil> X-Newsreader: Gnus v5.1 Xref: euryale.cc.adfa.oz.au comp.unix.bsd:16831 comp.unix.programmer:43866 comp.unix.questions:88365 >>>>> "Grace" == Grace Huynh <gpham@cod.nosc.mil> writes: Grace> I'm just beginning program in socket. Some concepts that I'm Grace> quite understand. Please help me to understand more. Grace> I'm not sure if I understand about ASYNCHRONOUS and NON Grace> BLOCKING. My server had been set as ASYNCHRONOUS. I want my Grace> server running as both ASYNCHRONOUS and NON BLOCKING. Asynchronous mode [set by fcntl(fd,F_SETFL,FASYNC) or ioctl(FIOASYNC)] simply means that the socket will deliver SIGIO to a designated process or process group when data becomes available. It doesn't affect the actual behaviour of read/write/send/recv/connect/accept. Non-blocking mode [set by fcntl(fd,F_SETFL,O_NONBLOCK) or ioctl(FIONBIO)] means that operations (read,write,send,recv,accept) performed on the socket will not delay the process; they will transfer what data they can, and if none was transferred, return -1 with errno set to either EAGAIN or EWOULDBLOCK (depending on the system, and on which method was used to set nonblocking mode). Also, connect() will behave slightly oddly; it will return -1 / EINPROGRESS immediately, and you can then check for completion of the connect with select(). Grace> By default all servers are in NON BLOCKING or I have set it Grace> for NON BLOCKING with FIONBIO? By default all sockets are blocking. Non-blocking mode must specifically be requested. Grace> Having these two together. Doesn't cause a confict isn't it? No. Hope this helps -- Andrew Gierth (andrewg@microlise.co.uk) "Ceterum censeo Microsoftam delendam esse" - Alain Knaff in nanam