knight0fdragon
Feb 9 2006, 04:40 AM
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
Feb 9 2006, 05:24 AM
WHAT??????????
knight0fdragon
Feb 9 2006, 05:28 AM
QUOTE (Warlord698 @ Feb 9 2006, 12:24 AM)
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
Feb 9 2006, 07:10 AM
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
Feb 9 2006, 12:37 PM
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
Feb 9 2006, 01: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
bafio
Feb 9 2006, 02:41 PM
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
Feb 9 2006, 03:44 PM
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
Feb 9 2006, 03: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
parrot
bafio
Feb 9 2006, 04:06 PM
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
parrot
Well also blabla is not really ok
Bafio
MaHe
Feb 9 2006, 04:41 PM
About the server. Port a server application to DSLinux. It should work then.
knight0fdragon
Feb 9 2006, 05:34 PM
QUOTE (MaHe @ Feb 9 2006, 11:41 AM)
About the server. Port a server application to DSLinux. It should work then.

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
Feb 9 2006, 06: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.
bafio
Feb 9 2006, 07:56 PM
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
Feb 10 2006, 01:50 AM
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
Feb 10 2006, 03:42 AM
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.