Return to BSD News archive
From: mdavies@froude.demon.co.uk (Miles Davies) Subject: Re: asyn and nonblocking Message-ID: <843726989snz@froude.demon.co.uk> References: <3247E23A.67DD@cod.nosc.mil> Date: Thu, 26 Sep 96 08:36:29 GMT Organization: Myorganisation Reply-To: mdavies@froude.demon.co.uk X-Newsreader: Demon Internet Simple News v1.30 Lines: 30 Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!cancer.vividnet.com!hunter.premier.net!news.mathworks.com!www.nntp.primenet.com!nntp.primenet.com!dispatch.news.demon.net!demon!mail2news.demon.co.uk!froude.demon.co.uk!mdavies Newsgroups: comp.unix.bsd,comp.unix.programmer,comp.unix.questions X-NNTP-Posting-User: mdavies@froude.demon.co.uk X-Mail2News-Path: news.demon.net!froude.demon.co.uk Xref: euryale.cc.adfa.oz.au comp.unix.bsd:16832 comp.unix.programmer:43913 comp.unix.questions:88424 In article <3247E23A.67DD@cod.nosc.mil> gpham@cod.nosc.mil "Grace Huynh" writes: [after some serious snipping of white space, very good in code, not so great in email] > I'm just beginning program in socket. Some concepts that I'm quite > understand. Please help me to understand more. > I'm not sure if I understand about ASYNCHRONOUS and NON BLOCKING. My > server had been set as ASYNCHRONOUS. I want my server running as both > ASYNCHRONOUS and NON BLOCKING. > By default all servers are in NON BLOCKING or I have set it > for NON BLOCKING with FIONBIO? > Having these two together. Doesn't cause a confict isn't it? > non-blocking means that if you ask to read and there is no data available the call will return with errno set to EWOULDBLOCK If you try to write and it is not possible as buffers are full then the same thing. This is not the normal state of affairs and must be explicitly requested. Asynchronus means you can request an interrupt to indicate when data is available to read or when space is available to write, (not so sure about this side of things). This allows you to go away and do something else until the socket is available to use. I'm a bit rusty on this so please confirm by reading the documentation. There is also a very good socket FAQ out there somewhere. -- Miles Davies (my Boss probably wouldn't agree with what I just said.)