asynchronous socket writing

Marc Lehmann schmorp at schmorp.de
Thu Mar 11 20:45:28 CET 2010


On Thu, Mar 11, 2010 at 06:02:15AM -0800, Brian Maher <maherb at brimworks.com> wrote:
> > They are non-blocking when the underlying fd is non-blocking, they are
> > never asynchronous.
> 
> What is the difference between non-blocking and asynchronous?

Non-blocking simply means that the OS will not wait for more data when it
doesn't know whether there will be some or not (or waiting for data to be
transferred), and asynchronous means data will be transferred in parallel
to your program.

> thought these words where synonyms, and wikipedia seems to think so
> 
>   http://en.wikipedia.org/wiki/Asynchronous_I/O

I am always at a loss of words when somebody uses wikipedia as if it were an
argument. Even the discussion page points out that it is all wrong...

There is nothing asynchronous about calling a function and waiting for it
to return with data (read, send). There are asynchronous functions, too
(aio_*), and claiming that they are all asynchronous is not really useful.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list