hello all.
I am working on a game and i have a strange crash.
in my game the client sends the host a msg after he presses the mouse.
If I press it one time or two times or mybe even three everything is ok.
But if I press it very fast (and i play the client side) the hosts program just crash and i have no idea why.
Anyone has any idea why?
P.s My program counts on that the first msg is a number and the next comes with _
And if its not that it might crash.
Mybe thats it but i have no idea.
(There is only 1 place in the whole game where it sends and get msgs. if its need to send anything it add it to the Vector themsgs
and it waits until it get to that part of the game in order to send it.)
(the function akel will make the game crash if its get wrong info)
this is my host side:
if (SDLNet_CheckSockets(sockkset, 2) > 0 )
{
if (SDLNet_TCP_Recv(csd, infoo, 512))
{
fprintf( stderr, "Reacived %s ", infoo);
int haaag = int(atoi(infoo)) ;
int awqer2 = SDL_GetTicks();
for (int iag=0;iag<haaag;iag++)
{
if (SDLNet_TCP_Recv(csd, infoo, 512))
{
akel(infoo);
fprintf( stderr, "(inside Reacived %s )", infoo);
}
}
}
}
this is my client side (only the stuff matters)
int awqer = SDL_GetTicks();
for (int kak=0;kak<countmsg;kak++)
{
while ((SDL_GetTicks()-awqer)<50)
{
}
len = strlen(themsgs[kak].sendingdata) + 1;
if (SDLNet_TCP_Send(sd, (void *)themsgs[kak].sendingdata, len) < len)
{
wwhat=0;
mode=0;
}
awqer = SDL_GetTicks();
}
thanks in advance