nanog mailing list archives

Re: dns and software, was Re: Reliable Cloud host ?


From: Owen DeLong <owen () delong com>
Date: Thu, 1 Mar 2012 14:37:07 -0800

William,

I could have done it in a lot less lines of code, but, it would have been much less readable.

Not blocking on the connect() call is a little more complex, but, not terribly so. It does, however, again, make the 
code quite a bit less readable.

There are libraries available that abstract everything I did there and you are welcome to use them.

Since C does not support overloading, they export different functions for the behavior you seek.

If you want, program in Python where the libraries do provide the abstraction you seek. Of course, that means you have 
to cope with Python's other disgusting habits like spaces are meaningful and variables are indistinguishable from code, 
but, there's always a tradeoff.

You don't have to reinvent what I've done. Neither does every or any other application programmer.
You are welcome to use any of the many connection abstraction libraries that are available in open source. I suggest 
you make a trip through google code.

Owen

On Mar 1, 2012, at 2:09 PM, William Herrin wrote:

On Thu, Mar 1, 2012 at 4:07 PM, Owen DeLong <owen () delong com> wrote:
I think that the modern set of getaddrinfo and connect is actually not that complicated:

Owen,

If took you 50 lines of code to do
'socket=connect("www.google.com",80,TCP);' and you still managed to
produce a version which, due to the timeout on dead addresses, is
worthless for any kind of interactive program like a web browser. And
because that code isn't found in a system library, every single
application programmer has to write it all over again.

I'm a fan of Rube Goldberg machines but that was ridiculous.

Regards,
Bill Herrin





-- 
William D. Herrin ................ herrin () dirtside com  bill () herrin us
3005 Crane Dr. ...................... Web: <http://bill.herrin.us/>
Falls Church, VA 22042-3004



Current thread: