Help - Search - Members - Calendar
Full Version: blocking?
1Emulation.Com > Official Emulator Forums > DSWifi
knight0fdragon
how do i turn blocking on for recvfrom???


also can the DS act as a server??? for some reason gethostbyaddr will not work from the PC side to the DS IP
Warlord698
WHAT??????????
knight0fdragon
QUOTE (Warlord698 @ Feb 9 2006, 12:24 AM)
WHAT??????????
*



what dont u understand?????


i want to use sync sockets not async, but for some reason it seems its async by default

and i like to use the DS as a server, so that other DS's could communicate via wifi but the function gethostbyaddr will not recognize the IP on the DS, itll act as if the IP doesnt exist
Sintax
This is a legitimate question. To set a socket nonblocking use this after you bind() it:

ioctl(sock, FIONBIO, &i);

'sock' is the socket of course, and 'i' should be an int set to a nonzero value to set it as nonblocking.

I don't know about your second question though.
Warlord698
I guesse I just didn't understand what he was wanting to do it for, like for a specific program or just in general, still learning on stuff ya know
knight0fdragon
i want blocking, not non blocking. I do not use that code you said, but for some reason, recvfrom is not waiting for data like its suppose to

as for the second question, has anyone placed the DS into server mode??? I ask this because it is like my PC does not recognize the IP when i access it
bafio
QUOTE (knight0fdragon @ Feb 9 2006, 02:57 PM)
i want blocking, not non blocking.  I do not use that code you said, but for some reason, recvfrom is not waiting for data like its suppose to

as for the second question, has anyone placed the DS into server mode???  I ask this because it is like my PC does not recognize the IP when i access it
*


As for the blocking, I use a while loop with timeout, something like

int time=0;
while (time<maxtime){
j=rcvdfrom(blabla)
if j!=-1
break;
time++;
swiWaitForVbalnk
}

in this case maxtime is the timeout (if you don't want to wait forever) and so it's a number of vblanks (60/second). like, for a blockng of 5 seconds, maxtime=60*5

Hope this helps...

Bafio
knight0fdragon
yea that is what I am using now, I just thought that I was missing something here, but I guess not. Ok then thanks a lot, I just need some answer on the server, perhaps thats not gonna happen till the next installment of the lib
parrot
QUOTE (bafio @ Feb 9 2006, 02:41 PM)
int time=0;
while (time<maxtime){
j=rcvdfrom(blabla)
if j!=-1
  break;
time++;
swiWaitForVbalnk
}
*

I've got some nit-picking:
It's swiWaitForVblank(); not swiWaitForVbalnk

biggrin.gif

parrot
bafio
QUOTE (parrot @ Feb 9 2006, 04:54 PM)
QUOTE (bafio @ Feb 9 2006, 02:41 PM)
int time=0;
while (time<maxtime){
j=rcvdfrom(blabla)
if j!=-1
  break;
time++;
swiWaitForVbalnk
}
*

I've got some nit-picking:
It's swiWaitForVblank(); not swiWaitForVbalnk

biggrin.gif

parrot
*



Well also blabla is not really ok biggrin.gif biggrin.gif
Bafio
MaHe
About the server. Port a server application to DSLinux. It should work then. smile.gif
knight0fdragon
QUOTE (MaHe @ Feb 9 2006, 11:41 AM)
About the server. Port a server application to DSLinux. It should work then. smile.gif
*



no thats ok, I would like a server and client in 1 package, thus 1 ROM, so that I could take my games online and play friends from round da world
Sintax
Oh whoops, blocking. I'm pretty sure it's blocking my default, although theres is a define although the lines of SGIP_BLOCKING_DEFAULT. If you were to set 'i' to 0 it would block, but maybe it just doesn't work in SG's lib. It's easy enough to do artificially like you already are.
bafio
QUOTE (Sintax @ Feb 9 2006, 07:45 PM)
Oh whoops, blocking. I'm pretty sure it's blocking my default, although theres is a define although the lines of SGIP_BLOCKING_DEFAULT. If you were to set 'i' to 0 it would block, but maybe it just doesn't work in SG's lib. It's easy enough to do artificially like you already are.
*


I remember sgstair saying something about blocking methods coming in the next version, anyway this method (while loop) works quite well now...

As for the DS as a server, I see it as quite a hard task, you would need port forwarding (quite probably) and all of that...

Bafio
sgstair
Correct, this version doesn't support blocking mode (all sockets are non-blocking) - next version will start sockets in blocking mode and allow you to turn it off (with ioctl)

-Stephen
knight0fdragon
QUOTE (sgstair @ Feb 9 2006, 08:50 PM)
Correct, this version doesn't support blocking mode (all sockets are non-blocking) - next version will start sockets in blocking mode and allow you to turn it off (with ioctl)

-Stephen
*



ok thanks for all the info, since i made a networking class for his stuff, I will just wait till the next version of the lib, and update the classes, i can still use what i got, - the server portion as of now
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.