Re: getaddrinfo() returns EAI_NONAME
Re: getaddrinfo() returns EAI_NONAME
- Subject: Re: getaddrinfo() returns EAI_NONAME
- From: Josh Graessley <email@hidden>
- Date: Fri, 28 Aug 2009 12:45:14 -0700
Just use the reachability APIs and don't do your getaddrinfo until
after a reachability change. And give the dns settings a second or two
to percolate through the system.
-josh
On Aug 28, 2009, at 11:49 AM, Satish Kilaru wrote:
HI Eli
Thanks for the reply.
Yes, we need to support many older versions.
Will setting OrderPreference = 'Last' guarantee that my service is
started after DNS service is up? What is the name of the service
that provides name resolution service?
Even 10 minutes after the machine is booted up I get this problem.
If I restart the service it runs fine.
--Satish
-----Original Message-----
From: macnetworkprog-bounces+skilaru=email@hidden
[mailto:macnetworkprog-bounces
+skilaru=email@hidden] On Behalf Of Eli Bach
Sent: Friday, August 28, 2009 2:09 PM
To: email@hidden
Subject: Re: getaddrinfo() returns EAI_NONAME
On Aug 28, 2009, at 10:07 AM, Satish Kilaru wrote:
HI All
I have a service that starts at boot time. Upon machine reboot my
service starts up. But getaddrinfo() returns EAI_NONAME. If I kill
the service and start It again from a login shell, getaddrinfo()
works fine.
What could be the reason? Is it because my service is starting
before some system service?
First, unless you are supporting older OS's (like 10.3), you should be
using launchservices instead of a SystemStartup item
Second, yes, given your plist, most likely your daemon is loading
before the network stack has loaded and configured. With a
SystemStartupItem, you can add a dependency, so that your daemon loads
after the network stack is loaded (but you may still not have a valid
network connection).
With launchservices, you need to test yourself whether the network is
available and then try to resolve the name. Or you could just retry
the operation after a period of time.
Eli
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
******************Legal Disclaimer***************************
"This communication may contain confidential and privileged material
for the sole use of the intended recipient. Any unauthorized review,
use or distribution by others is strictly prohibited. If you have
received the message in error, please advise the sender by reply
email and delete the message. Thank you."
****************************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden