Help - Search - Members - Calendar
Full Version: Stripped down WiFi test source
1Emulation.Com > Official Emulator Forums > DSWifi
Sintax
I was stripping down wifi_lib_test and figured I'd give it out to save other people the hassle. Here is extremely basic source which does the minimum to get you connected to an AP and has a simple UDP test. I've also heavily commented it, so developers can have the essentials needed to hopefully get up and running with WiFi code quickly.

Download here

Everything is all set up, so a simple 'make' command to the unzipped directory should pop out an nds and gba.nds.
El_Hobito
is this supposed to work with udp_test? it does nothing when i try it with my code and neither with this yet the official one works fine.
DragonMinded
QUOTE (El_Hobito @ Jan 11 2006, 07:33 PM)
is this supposed to work with udp_test? it does nothing when i try it with my code and neither with this yet the official one works fine.
*


You would probably have to change the internal IP and port. Since I'm protected by WEP here, I recompiled the source with the IP to send to as my outside line, forwarded port 8888, and stole a neighbor's wifi to test, and it seems to work fine. Make sure you aren't mismatching ports somewhere...
El_Hobito
i've done all that though i sent it to 192.168.2.101 (my comp ip) which is the destip on port 8888 but i get nothing. hmmm i might try send it through the internet see where that gets me.
El_Hobito
QUOTE (El_Hobito @ Jan 12 2006, 02:29 PM)
i've done all that though i sent it to 192.168.2.101 (my comp ip) which is the destip on port 8888 but i get nothing.  hmmm i might try send it through the internet see where that gets me.
*

i've tried everything i can think of but it wont work, i dont get it? i've basically have copied and pasted the original and this code but it wont work
its says dest ip :192.168.2.101 (my comp)
source 192.168.1.189 (ds)
port : 8888

but i get no response
if(Stylus.Held) {
if(Stylus.X>208 && (Stylus.Y>144)){
strcpy(sendbuf,text);

sain.sin_family=AF_INET;
sain.sin_port=htons(portnum);
sain.sin_addr.s_addr=destip;
sendto(sock,"test",strlen("test"),0,(struct sockaddr *)&sain,sizeof(sain));

}

that pretty much a copy of sgstairs version but i've hardcoded a message in this case.(it was using a typed version b4)
i noticed that yours says out and stevens says in which is odd but i swapped them and it made no difference.
thoduv
QUOTE (DragonMinded @ Jan 12 2006, 07:34 AM)
QUOTE (El_Hobito @ Jan 11 2006, 07:33 PM)
is this supposed to work with udp_test? it does nothing when i try it with my code and neither with this yet the official one works fine.
*


You would probably have to change the internal IP and port. Since I'm protected by WEP here, I recompiled the source with the IP to send to as my outside line, forwarded port 8888, and stole a neighbor's wifi to test, and it seems to work fine. Make sure you aren't mismatching ports somewhere...
*



WEP's working ? blink.gif
El_Hobito
no hence he has to steal his neighbours internet
sgstair
QUOTE (El_Hobito @ Jan 12 2006, 12:06 PM)
QUOTE (El_Hobito @ Jan 12 2006, 02:29 PM)
i've done all that though i sent it to 192.168.2.101 (my comp ip) which is the destip on port 8888 but i get nothing.  hmmm i might try send it through the internet see where that gets me.
*

i've tried everything i can think of but it wont work, i dont get it? i've basically have copied and pasted the original and this code but it wont work
its says dest ip :192.168.2.101 (my comp)
source 192.168.1.189 (ds)
port : 8888

but i get no response
if(Stylus.Held) {
if(Stylus.X>208 && (Stylus.Y>144)){
strcpy(sendbuf,text);

sain.sin_family=AF_INET;
sain.sin_port=htons(portnum);
sain.sin_addr.s_addr=destip;
sendto(sock,"test",strlen("test"),0,(struct sockaddr *)&sain,sizeof(sain));

}

that pretty much a copy of sgstairs version but i've hardcoded a message in this case.(it was using a typed version b4)
i noticed that yours says out and stevens says in which is odd but i swapped them and it made no difference.
*



Please note that in general you cannot send data from a 192.168.1.* address to a 192.168.2.* without a gateway system configured for the connection between the two seperate networks (I'm willing to bet you don't have such in place)
This isn't rocket science, but it really really helps to have a solid understanding of networking... if you do have further questions, I'm more open to talking on IRC - see #dswifi on EFnet - I'm usually around. (Forums are good for lengthy discussions about topics that most parties understand well, but are not as well suited for teaching, etc - IMO)

-Stephen
El_Hobito
QUOTE (sgstair @ Jan 13 2006, 08:33 AM)
QUOTE (El_Hobito @ Jan 12 2006, 12:06 PM)
QUOTE (El_Hobito @ Jan 12 2006, 02:29 PM)
i've done all that though i sent it to 192.168.2.101 (my comp ip) which is the destip on port 8888 but i get nothing.  hmmm i might try send it through the internet see where that gets me.
*

i've tried everything i can think of but it wont work, i dont get it? i've basically have copied and pasted the original and this code but it wont work
its says dest ip :192.168.2.101 (my comp)
source 192.168.1.189 (ds)
port : 8888

but i get no response
if(Stylus.Held) {
if(Stylus.X>208 && (Stylus.Y>144)){
strcpy(sendbuf,text);

sain.sin_family=AF_INET;
sain.sin_port=htons(portnum);
sain.sin_addr.s_addr=destip;
sendto(sock,"test",strlen("test"),0,(struct sockaddr *)&sain,sizeof(sain));

}

that pretty much a copy of sgstairs version but i've hardcoded a message in this case.(it was using a typed version b4)
i noticed that yours says out and stevens says in which is odd but i swapped them and it made no difference.
*



Please note that in general you cannot send data from a 192.168.1.* address to a 192.168.2.* without a gateway system configured for the connection between the two seperate networks (I'm willing to bet you don't have such in place)
This isn't rocket science, but it really really helps to have a solid understanding of networking... if you do have further questions, I'm more open to talking on IRC - see #dswifi on EFnet - I'm usually around. (Forums are good for lengthy discussions about topics that most parties understand well, but are not as well suited for teaching, etc - IMO)

-Stephen
*


yes i realised that almost as soon as i posted it. Believe it or not i actually have a degree in internet engineering tongue.gif so now i feel really dumb, i probably should have withdrawn that. You dont need to teach me about it but thanks anyway.
sgstair
Haha, ok - well. I'm still around if you do have questions smile.gif

-Stephen
El_Hobito
QUOTE (sgstair @ Jan 13 2006, 08:20 PM)
Haha, ok - well. I'm still around if you do have questions smile.gif

-Stephen
*

thanks i think i might have found a bug in the wifi since my progs crashing at the mo but i wont bother with it yet since i've yet to do any sort of investigation into the cause and as we all know its far from finished. i've been making a real idiot of myself recently! thats 3 times in row now i've post a question only to realise my mistake about 5mins later lol. You've probably got a point though i probably ought to have a read through my book just to refresh. For now though i'll get someone to independently verify this problem and try and get to the root of it (its probably my fault!) then i'll just leave the wifi part until the lib can mature a bit methinks, i'll c how it goes.
cybereality
Thanks a bunch Sintax. This is really gonna help me out with the little app I'm writing. I just got a chance to skim through the code, but it looks very clean and well commented. I'm sure a lot of other people will appriciate a bare-bones example to learn from. Good job man.

// cybereality
davr
3 minor typos, "stdlib.h" should be lowercase, and you should only use forward slashes in #includes

CODE
wifistripped/arm9/source/arm9.c:12:20: error: Stdlib.h: No such file or directory
wifistripped/arm9/source/arm9.c:18:24: error: sys\socket.h: No such file or directory
wifistripped/arm9/source/arm9.c:19:24: error: netinet\in.h: No such file or directory


thanks though, this will save me some work, i was planning on doing the same thing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.