vha Posted November 28, 2007 Share Posted November 28, 2007 How can I interrupt waiting for data in recv() function? I must wait until function recive data from server to proceed. while (1) { readbytes = recv(gniazdo, (char*)&glowa, sizeof(glowa), 0 ); if (Stylus.X<19 && Stylus.Y>172) { if(keybord<=0) {if(keybord==-1)PA_InitKeyboard(2);PA_KeyboardIn(20, 95); keybord=1;} else {PA_KeyboardOut();keybord=0;} Stylus.X=0; Stylus.Y=0; } . . . }If i dont get data then i can't read stylus position. I solve this problem on my PC:struct timeval tv = {0,0}; while(1) { fd_set fs = {1,gniazdo}; if (select(0, &fs,NULL,NULL,&tv) == 1) { readbytes = recv(gniazdo, (char*)&glowa, sizeof(glowa), 0); if (...) { ... } . . . }But this method don’t seam to work on DS what is wrong with my code? how can I fix it? sorry for my poor Englis Link to comment Share on other sites More sharing options...
Weirdy Posted November 28, 2007 Share Posted November 28, 2007 Using select() and recv() would mean that the DS would have to be POSIX compatible, no? Or at least mean that there are libraries available that make it compatible with POSIX. Link to comment Share on other sites More sharing options...
vha Posted November 28, 2007 Author Share Posted November 28, 2007 Using select() and recv() would mean that the DS would have to be POSIX compatible, no? Or at least mean that there are libraries available that make it compatible with POSIX.you want to say that i can't use select() on DS?than why this guy is using it?:http://www.1emulation.com/forums/index.php?showtopic=22833 as you can see code is very similar Link to comment Share on other sites More sharing options...
sgstair Posted November 28, 2007 Share Posted November 28, 2007 select() is supported in the dswifi lib - you just can't setup the fd_set like that.Another alternative would be to use nonblocking sockets (research ioctl() and FIONBIO) Good luck Link to comment Share on other sites More sharing options...
vha Posted November 29, 2007 Author Share Posted November 29, 2007 select() is supported in the dswifi lib - you just can't setup the fd_set like that.Another alternative would be to use nonblocking sockets (research ioctl() and FIONBIO) Good luck god this is so simple thx m8 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now