You get libRefNum from SysLibFind("Net.lib", &libRefNum). Then, you iterate
through all the interfaces, skipping the loopback interface. When you find
one that reports up, then you have a network. It may not be the network you
want or can use, but you know something is up. Here's some code:
Boolean IsAnyNetworkUp(UInt16 libRefNum)
{
UInt16 instance,size,index = 0;
UInt32 creator;
UInt8 value;
Err err;
while (1)
{
err = NetLibIFGet(libRefNum,index,&creator,&instance);
if (err == netErrInvalidInterface)
return false;
if (err == errNone && creator != netIFCreatorLoop)
{
size = sizeof(value);
if
(NetLibIFSettingGet(libRefNum,creator,instance,netIFSettingUp,&value,&size)
== errNone &&
value != 0)
return true;
}
}
}
On 3/19/07, Luca Bertoncello <[EMAIL PROTECTED]> wrote:
>
> "Dmitry Grinberg" <[EMAIL PROTECTED]> schrieb:
>
> > oh, sorry...the call you need is
> >
> > UInt8 val;
> > UInt16 sz=sizeof(val);
> > UInt32 ifCreator,ifInstance;
> >
> > //get creator and instance of PPP connection here...
> >
> > NetLibIFSettingGet
> (netRefNum,ifCreator,ifInstance,netIFSettingUp,&val,&sz);
> >
> > val now has the state (up or down)
>
> Could you say me where I get the values of netRefNum, ifCreator and
> ifInstance?
>
> Thanks
> Luca Bertoncello
> ([EMAIL PROTECTED])
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>
--
[Jeff Loucks]
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/