forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Common error when enumerating Wifi connections

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Tue Mar 28, 2006 12:46 pm    Post subject: Common error when enumerating Wifi connections Reply with quote

I've recently discovered a small bug that was in PSPPets wifi examples in the way it enumerates wifi connections.

Code:
        for (iNetIndex = 1; iNetIndex < 100; iNetIndex++) // skip the 0th connection
        {
            //variable declarations go here
            if (sceUtilityCheckNetParam(iNetIndex) != 0)
                break;  // no more
            .......... // <- at this point you have a good connection, add it to your picks list
        }

This is incorrect as if a user has added 2 wifi connections and then deleted the first one (in their network settings), then when you call sceUtilityCheckNetParam(1); it will return a non zero value so you will stop looking for new connections, but if you called sceUtilityCheckNetParam(2); it would return zero as there is a connection set up there.

Alter the code to do continue; instead of break; when sceUtilityCheckNetParam(iNetIndex) returns a non-zero value, giving:
Code:
        for (iNetIndex = 1; iNetIndex < 100; iNetIndex++) // skip the 0th connection
        {
            //variable declarations go here
            if (sceUtilityCheckNetParam(iNetIndex) != 0)
                continue;  // no connection here
            .......... // <- at this point you have a good connection, add it to your picks list
        }

So we check the first 100 network connections to see if there is a connection set up in any of them instead of stopping when we hit the first index where there is no network connection.
This finds connections where previously we would stop looking prematurely.

This probably isn't the best fix as that 100 value is just pulled out of nowhere (afaik), but it should be a big enough value that you won't have any problems.

Hope that helps everyone who is using wifi, as It took me a while to realize what was causing it!
I'll put the fix in the next versions of all my wifi apps.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Wed Mar 29, 2006 7:49 pm    Post subject: Reply with quote

thanx
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
raf



Joined: 13 Oct 2005
Posts: 57

PostPosted: Sun Apr 02, 2006 1:39 pm    Post subject: Re: Common error when enumerating Wifi connections Reply with quote

Interesting... This may explain reports from various PSPRadio users.. I'll update my code to this..

Thanks!,

Raf.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group