Re: how to get the status of network when the network is set disable.

2008-07-12 Thread xiaobin
Thank you the quickly advices of Michael and Mike very much. I test Michael's sample, it works well. But I think the SCNetworkReachability API is also used to try to connect to the server, right? What I want is to get the status of the network without any connection to the server. Maybe What I

Re: how to get the status of network when the network is set disable.

2008-07-12 Thread Jens Alfke
On 12 Jul '08, at 9:46 AM, xiaobin wrote: I test Michael's sample, it works well. But I think the SCNetworkReachability API is also used to try to connect to the server, right? What I want is to get the status of the network without any connection to the server. The SC reachability API does

Re: how to get the status of network when the network is set disable.

2008-07-12 Thread Stefan Arentz
On Jul 9, 2008, at 8:22 AM, xiaobin wrote: Hello, I am writing a program to detect the status of network. In my program, I need get the status of network when the connection is set disable. here it is not by connecting the network to get the status. which API or method can work for it?

how to get the status of network when the network is set disable.

2008-07-09 Thread xiaobin
Hello, I am writing a program to detect the status of network. In my program, I need get the status of network when the connection is set disable. here it is not by connecting the network to get the status. which API or method can work for it? for example, if my lan cable is unpluged or the

Re: how to get the status of network when the network is set disable.

2008-07-09 Thread Michael Kaye
Try the SCNetworkReachability API... I borrowed the following from one of Apple's examples: - (BOOL)isDataSourceAvailable { static BOOL checkNetwork = YES; if (checkNetwork) { // Since checking the reachability of a host can be expensive, cache the result and perform the reachability

Re: how to get the status of network when the network is set disable.

2008-07-09 Thread Mike
The SCF documentation specifically says SC routines cannot be used to test *remote* reachability and should only be used to test whether a packet can *leave* the host. If this is all you need, then Michael's example will work. If you need to test remote reachability, you will need to devise