Jump to content

Recommended Posts

Posted

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 :D

what is wrong with my code? how can I fix it?

 

sorry for my poor Englis

Posted

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.

Posted

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 :D

Posted
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 :D

god this is so simple

 

thx m8

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...