I've createdan application which communicates with external device using TCP/IP as a client. I'm using Synapse library (v40) for communication. Sometimes however communication freezes. I managed to get callstack with JclDebug,showing that despite defined timeout, receiving packets is the problem.
Delphi 2009 is used.
Is there anything I can do to fix this issue? Bug in Synapse?
[77297094] KiFastSystemCallRet
[006193FE] blcksock.TBlockSocket.InternalCanRead (Line 2741, "synapse\blcksock.pas")
[0061945C] blcksock.TBlockSocket.CanRead (Line 2764, "synapse\blcksock.pas")
[006185E5] blcksock.TBlockSocket.RecvPacket (Line 2324, "synapse\blcksock.pas")
[0061888F] blcksock.TBlockSocket.RecvTerminated (Line 2410, "synapse\blcksock.pas")
... my own code..
Edit: The blocking line is:
x := synsock.Select(FSocket + 1, @FDSet, nil, nil, TimeVal);
Select -function is from winsock2 API.
Edit2: TimeVal is set by Synapse code:
var
TimeVal: PTimeVal;
TimeV: TTimeVal;
..
TimeV.tv_usec := (Timeout mod 1000) * 1000;
TimeV.tv_sec := Timeout div 1000;
TimeVal := @TimeV;
if Timeout = -1 then
TimeVal := nil;
Original source code is here: http://synalist.svn.sourceforge.net/viewvc/synalist/trunk/blcksock.pas?revision=154&view=markup
Timeout used is 1000.
Edit3: I've two client threads running to communicate with two different hosts. It looks like only other one is hanging. Application has been running now since thursday. Thread #2 hung after 5 hours, but thread #1 is still running.
As I couldn't find the reason for the freeze, I changed by code a bit and now end up calling RecvTerminated with CRLF as terminater instead of '>', and it seems to work without stopping.