-
October 20th, 2010, 05:28 PM
#1
WSAAsyncSelect freezes?
Hello, I have a weird problem that i'm desperately trying to solve:
I have a server which uses WSAAsyncSelect to handle multiple clients.
WSAAsyncSelect sends notification messages to the main window's procedure and the main window's procedure sends them to another Thread which handles them.
I can't post here the whole code because it's in too many files, and very long, but i'll post what's important.
Here's the part in Thread that handles the messages:
Code:
while(GetMessage(&ThreadMsg, (HWND)-1, 0, 0))
{
if(ThreadMsg.message == TCPIPM_LISTENEVENT)
{
if(LOWORD(ThreadMsg.lParam) == FD_ACCEPT)
cServer.Accept();
}
else
{
switch(LOWORD(ThreadMsg.lParam))
{
case FD_READ:
char buffer[520];
recv(socket, buffer, 520, 0);
MessageBox(NULL, "Message!", 0, 0);
}
}
}
Now, it's not the whole code AT ALL, but it's the part that gives the problem, which is:
if i send with the client multiple (4 times) send() one after the other, i receive only the first one.
the problem is that MessageBox somehow "blocks" the thread after the first send() and the other 3 send() never received.
if i eliminate MessageBox, the whole 4 send() are received correctly.
WHY IS THAT???
Please help me guys..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|