Chi Guan wrote:
>Hi, Greg, Thanks you for answering the question. I am sorry
> to accidently
> delete your message. Hope you can see this message. Every
> network settting
> are set for PPP default. Actually
> First I call err =
> NetLibIFAttach(AppNetRefnum,netIFCreatorPPP,ifInstance,AppNetT
> imeout), if
> paased
> Next : for (index = 0; 1; index++)
> {
> err = NetLibIFGet(AppNetRefnum, index, &ifCreator,
> &ifInstance);
> if(Creator == netIFCreatorPPP)
>
>
> break;
> }
> }
>
> Than: err = NetLibIFSettingSet(AppNetRefnum, ifCreator, ifInstance,
> netIFSettingServiceName, &Name, buflen);
> Than err = NetLibOpen(AppNetRefnum, &ifErrs);
>
> All above API calls are passed and have no error,( also, ifErrs = 0);
>
> However, the network opened is not the one I attached, but
> the old one.
>
> I believe another gentalman, Russell Bulmer, post a message
> "NetLibOpen -
> PalmOS 3.1 / 3.3 issues". He has the same problem as mine,
> except, he did
> not attach new one, but try to modify the current setting. (I
> have try to do
> the same thing but failed). If you take a look of his
> message, you may
> have clearer idea.
> Thank you.
>
I am that gentleman...
If you think you many be running into the same problem as myself, you could
try running your application on a device running PalmOS 3.1 - If it works on
there, but not on 3.3, you may be experiencing the same problem as myself.
Also... I think I may have a handle on what may be going wrong for you.
What you're doing is attaching an ADDITIONAL interface. This means that if
there were any interfaces already attached, they'll still be there.
When you can NetLibOpen() it tries to open (bring up) all attached
interfaces to it. That means that if there was already an interface
attached before you attached yours, you would have 2 interfaces to bring up.
As you cycle past any existing interfaces in your code, your interface will
be the last to be brought up.
So, I'm thinking the following may happen:
- An interface is already attached. Quite possibly the AmiNet one that's
selected by default in the Network Preferences.
- Your code goes cycles through all interface instances and then adds your
interface at the end. So, if the AmiNet interface was ifCreator=0, yours
would be ifCreator=1
- You call NetLibOpen() - and NetLib tries to bring up all the attached
interfaces. It starts at ifCreator=0 and tries to bring up the AmiNet
interface.
Now... once it's brought that one up I'm guessing the system will not try
and bring up another PPP connection, as you can't have more than one PPP
connection at any given time.
Maybe if the first interface failed (cancel it, don't connect to the modem
or something) your interface would be brought up afterwards?
If you always quit debugging when you see the incorrect interface being
brought up, it may be that if you waited until the first had finished that
you'd be given some indication of your interface trying to be brought up
afterwards, like the first being disconnected, or an error coming up saying
"can't connect - connection already in use" or something.
All this additional thinking I've been doing regarding your problem has also
helped me with my problem... Currently I'm trying the following:
- Go through looking for PPP interface
- If I find one - detach it
- Once I've detached all the existing interfaces, I attach mine.
- call NetLibOpen()
This sometimes... but not always... (seems to be to do with what interfaces
I detach) I'm still working on it, and when (if...) I work it out I'll post
again.
Cheers
Russell
Russell K Bulmer
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html