Re: Name resolution limits
Re: Name resolution limits
- Subject: Re: Name resolution limits
- From: Josh Graessley <email@hidden>
- Date: Thu, 07 Feb 2002 17:53:27 -0800
While you can write resolver routines yourself, I would advise against it.
There are many things Mac OS Xs resolver will do that your resolver would
not. Mac OS Xs resolver APIs just make mach message calls to lookupd.
Lookupd is a complicated and elaborate beast. It does more than just DNS
lookups, it will use other directory services available on the system such
as netinfo and, I believe, LDAP. I'm not sure of the specifics. At any rate,
lookupd does a lot your resolver probably wouldn't. In the future, it may do
more. For the sake of consistent results, it is probably best to use the
APIs.
This is not a problem with Mac OS Xs networking, this is a problem with the
design of the APIs used to lookup names. The APIs are written for a world
where you simply block to wait for an operation to complete. The original
APIs, such as gethostbyname return a pointer to the results. The pointer
points to a per process global structure. If you have multiple threads
running and they're using the same API, the results stored in the global
will be overwritten by one thread before another thread can read the
results. There is a gethostbyname_r or gethostbynamer, I can't recall the
name, that's supposed to be thread safe. I believe it allocates storage per
thread. I do not think that function is available on Mac OS X. Since
getnameinfo and getaddrinfo require you to pass in storage for the results
they don't have the same problem as gethostbyname. They're still blocking
APIs, so while your thread is calling them, it can not do anything else.
-josh
P.S. There is no gethostinfo, it's getnameinfo.
On 2/7/02 5:32 PM, "jud spencer" <email@hidden> wrote:
>
Are there any other routines that I can use to get around this limitation?
>
Or is the problem inherent to all OSX networking.
>
>
Is it possible to write these routines myself using OT? I haven't read the
>
RFC's for these items.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.