ok
i have duplicated the network control panel way of doing it
it works
here is the code....
returns true if up, else false
UInt32 ArmletMain(void* crap1,void* param,void* crap2){
UInt32 ret=0;
UInt16 openCount;
Err err,ifErr;
UInt8 crap;
UInt32 idx;
UInt32 ifCrid;
UInt16 ifInstance,size;
NetLibLoad();
err=NetLibOpenCount(&openCount);
if(err==errNone && openCount!=0){
err=NetLibConnectionRefresh(false,&crap,&ifErr);
if(err==errNone && ifErr==errNone && crap!=0 && openCount==1)
ret=true;
}
if(openCount!=1) goto ret_lbl;
idx=0;
while(1){
err=NetLibIFGet(idx,&ifCrid,&ifInstance);
if(err==errNone){
if(ifCrid=='_ram'){
size=1;
err=NetLibIFSettingGet(ifCrid,ifInstance,1,&crap,&size);
if(err!=errNone || crap==0) goto ret_lbl;
}
}
else if(err==netErrPrefNotFound ||
err==netErrInterfaceNotFound){
goto ret_lbl;
}
idx++;
}
ret_lbl:
NetLibUnload();
return ret;
}
On 3/19/07, Jeff Loucks <[EMAIL PROTECTED]> wrote:
Maybe I don't understand. Are you expecting NetLibOpenCount() to return a
count greater than zero? Do you think NetLib is open and connected? If
NetLibOpenCount() returns 0, then NetLib is not open and most likely not
connected to the network. NetLib cannot tell you if there is a network
available without being connected. Otherwise, the only thing you or it knows
is that it's not connected.
If the something like a browser has the network connected and you run this
code in the background, you may see NetLibOpenCount() return a count greater
than zero. Otherwise, expect it to be zero.
NetLibOpenIfCloseWait() is in NetMgr.h and has a comment there. It is
normally used in situations where one app closes NetLib and switches
immediately to another app that will be opening NetLib. There is a delay of
a few seconds before any connection is actually closed and all the
interfaces are shut down. This delay allows the NetLib to be handed off to
another net app without the need to reconnect. The pref panel is an example.
On 3/19/07, Luca Bertoncello <[EMAIL PROTECTED]> wrote:
> "Jeff Loucks" <[EMAIL PROTECTED]> schrieb:
>
> > Why the other isn't working for you, I can't say. Are you using a real
> > device? The simluator and emulator will often not work as expected.
>
> I tryed with the simulator, the emulator and a real palm...
> All of them say the same...
>
> > If you are concerned about opening the NetLib if it's not connected,
then...
> >
> > Use NetLibOpenCount() to see if it's already open. If it is, then it may
be
> > connected, so go see if the connection is good for your use.
>
> Unfortunately, NetLibOpenCount returns always 0...
> Maybe have I to call some other function before?
>
> > If NetLib is not already open, use NetLibOpenIfCloseWait() to open
NetLib
> > only if it hasn't completely closed from a previous use. In that case,
it
> > may still be connected.
>
> I can't find any issue of this function in the documentation...
>
> 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/
--
Best Regards, Dmitry Grinberg
Software Engineer, http://PalmPowerups.com
(847) 226 9295
AIM: DmitryGrinberg
MSN: [EMAIL PROTECTED]
ICQ: 165589894
Y! IM: dmitrygr2003
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/