I'm still searching for the cause of my problem. It keeps happening at 
intervals of a few hours, but very hard to reproduce at our office.

Looking at the call stack when in 'error state', it seems that winsock 
just keeps pushing FD_READ messages while there is actually no data to 
receive.
I've found someone who had with approx the same problem: 
http://www.gamedev.net/community/forums/topic.asp?topic_id=402571
Unfortunately there is no solution in that thread.

What is also really strange, is that at the moment I get the first 
OnDataAvailable event of the loop, fLastError is always set to 10053; 
this is strange,
since in TCustomWSocket.ASyncReceive, where the event is triggered, 
fLastError is set to 0 before the first event is triggered.

This always seems to happen when a client got disconnected (or timed 
out), sometimes it seems to be triggered by trying to send data, but 
sometimes I just get infinite FD_READ messages.

Can someone please shed some light? It's driving me crazy. Is there any 
way to detect why the event is being called at runtime, maybe I can get 
more information that way.

I also found a compiler define called TOMASEK in 
TCustomWSocket.TriggerDataAvailable. The comments with it describe 
approx what is happening to me:
    { Do not allow FD_READ messages, this will prevent reentering the }
    { OnDataAvailable event handler.                                  }

But I don't know what will happen if I use this piece of code; it seems 
to be very old.

Hoping to hear something soon!

regards,

Merijn


Merijn Bosma wrote:
> I've removed the parsing and processing of data from the OnDataAvailable.
> The event handler now basically contains ReceiveStr() and PostMessage().
>
> I'm still having the same problem though :(
> It seems that this problem is not triggered by doing something wrong 
> in the OnDataAvailable event handler, but somewhere else.
> I'm starting to think it's something in the sending of data since that 
> keeps coming back in the callstack (see attached callstack).
>
> Hoping someone can give me a hint.
>
> Merijn
> ------------------------------------------------------------------------
>
> |--------------------------------------------------------------------------------------------------------------------------|
> |7C810E31|kernel32.dll|                             |                         
>   |WriteFile                       |         |
> |7C90D590|ntdll.dll   |                             |                         
>   |NtClose                         |         |
> |7C809BA5|kernel32.dll|                             |                         
>   |CloseHandle                     |         |
> |7C809B67|kernel32.dll|                             |                         
>   |CloseHandle                     |         |
> |006BF6B2|AviaVox.exe |ServerTimedSocket.pas        |TServerTimedSocket       
>   |_Log                            |301[17]  |
> |71AA150A|WS2HELP.dll |                             |                         
>   |WahReferenceContextByHandle     |         |
> |71AB4376|WS2_32.dll  |                             |                         
>   |WSARecv                         |         |
> |71AB437D|WS2_32.dll  |                             |                         
>   |WSARecv                         |         |
> |71AB4318|WS2_32.dll  |                             |                         
>   |WSARecv                         |         |
> |71AD2E9E|wsock32.dll |                             |                         
>   |recv                            |         |
> |005C569F|AviaVox.exe |WSocket.pas                  |                         
>   |WSocket_Synchronized_recv       |2277[3]  |
> |005C6B00|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |DoRecv                          |3825[0]  |
> |005CC772|AviaVox.exe |WSocket.pas                  |TCustomSocksWSocket      
>   |DoRecv                          |6759[2]  |
> |0055F9C4|AviaVox.exe |PostPone.pas                 |TPostPone                
>   |PostPone                        |80[1]    |
> |006BF84E|AviaVox.exe |ServerTimedSocket.pas        |TServerTimedSocket       
>   |OnDataAvailable                 |333[20]  |
> |71AB44E5|WS2_32.dll  |                             |                         
>   |WSAIoctl                        |         |
> |71AB4489|WS2_32.dll  |                             |                         
>   |WSAIoctl                        |         |
> |71AB4536|WS2_32.dll  |                             |                         
>   |ioctlsocket                     |         |
> |005C5398|AviaVox.exe |WSocket.pas                  |                         
>   |WSocket_Synchronized_ioctlsocket|2136[3]  |
> |005C5374|AviaVox.exe |WSocket.pas                  |                         
>   |WSocket_Synchronized_ioctlsocket|2133[0]  |
> |005C7229|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |ASyncReceive                    |4226[28] |
> |7C80A424|kernel32.dll|                             |                         
>   |CompareStringW                  |         |
> |7C80A37E|kernel32.dll|                             |                         
>   |CompareStringW                  |         |
> |7C90D8ED|ntdll.dll   |                             |                         
>   |NtDeviceIoControlFile           |         |
> |71AB42F5|WS2_32.dll  |                             |                         
>   |send                            |         |
> |71AB42FC|WS2_32.dll  |                             |                         
>   |send                            |         |
> |005C52E7|AviaVox.exe |WSocket.pas                  |                         
>   |WSocket_Synchronized_send       |2098[3]  |
> |005C2808|AviaVox.exe |WSockBuf.pas                 |TBuffer                  
>   |Peek                            |212[0]   |
> |005C6D8A|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TryToSend                       |4006[16] |
> |005C6F07|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TryToSend                       |4070[80] |
> |7E41CBB3|USER32.dll  |                             |                         
>   |PostMessageA                    |         |
> |7E41CB69|USER32.dll  |                             |                         
>   |PostMessageA                    |         |
> |005C710A|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |Send                            |4164[31] |
> |005C715A|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |SendStr                         |4177[2]  |
> |006BFA70|AviaVox.exe |ServerTimedSocket.pas        |TServerTimedSocket       
>   |OnOutgoingEncryptedData         |372[3]   |
> |006BFA9A|AviaVox.exe |ServerTimedSocket.pas        |TServerTimedSocket       
>   |OnOutgoingEncryptedData         |375[6]   |
> |005CEB0D|AviaVox.exe |ConnectionAuthorize.pas      |TAuthorize               
>   |OutGoingData                    |363[12]  |
> |005C2808|AviaVox.exe |WSockBuf.pas                 |TBuffer                  
>   |Peek                            |212[0]   |
> |005C6D8A|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TryToSend                       |4006[16] |
> |7C9010ED|ntdll.dll   |                             |                         
>   |RtlLeaveCriticalSection         |         |
> |005C6F07|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TryToSend                       |4070[80] |
> |005C6F2C|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TryToSend                       |4073[83] |
> |005CA50F|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |TriggerDataSent                 |5985[8]  |
> |005C7168|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |ASyncReceive                    |4198[0]  |
> |005C72E7|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |Do_FD_READ                      |4259[5]  |
> |005C75C3|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |WMASyncSelect                   |4394[62] |
> |005C746C|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |WMASyncSelect                   |4332[0]  |
> |005C6129|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |WndProc                         |3290[4]  |
> |005C6100|AviaVox.exe |WSocket.pas                  |TCustomWSocket           
>   |WndProc                         |3286[0]  |
> |005CC8C7|AviaVox.exe |WSocket.pas                  |TCustomLineWSocket       
>   |WndProc                         |6824[12] |
> |005C6261|AviaVox.exe |WSocket.pas                  |                         
>   |XSocketWindowProc               |3341[14] |
> |7E4196B2|USER32.dll  |                             |                         
>   |DispatchMessageA                |         |
> |7E4196A8|USER32.dll  |                             |                         
>   |DispatchMessageA                |         |
> |00618A8C|AviaVox.exe |networkComm.pas              |TNetworkCommThread       
>   |Execute                         |445[12]  |
> |--------------------------------------------------------------------------------------------------------------------------|
>   

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to