Hello,

it seems that communicating, described in
 http://www.ararat.cz/synapse/doku.php/public:howto:activeconnection
does not help.

I made a simple demo of tcp client, the code is shown below.

After I connected to server and took out the LAN cable and there is a
red cross on the connection icon in the system tray, I can for about
30 seconds to send messages, and it does not get errors!


Can this be fixed?

Thanks.




procedure TTCPClientThread.Execute;
var: FSock: TTCPBlockSocket;
begin
  FSock := TTCPBlockSocket.Create();
  try
    FSock.Connect(Host, Port);
    if (FSock.LastError <> 0) then
      Begin
        _LogStr('Error: ' + IntToStr(FSock.LastError) + ','
+FSock.LastErrorDesc);
        Terminate;
      end;

    while (not Terminated) do
      Begin
        if FStrToSend <> '' then
          Begin
            FSock.SendString(AnsiString(FStrToSend));
            FStrToSend := '';
            if (FSock.LastError = 0) then
              Begin
                _LogStr('Message Sent !');
              end
            else
              Begin
                _LogStr('Error: ' + IntToStr(FSock.LastError) + ','
+FSock.LastErrorDesc);
                Terminate;
              end;
          end;
        if FSock.CanRead(0) then
          Begin
            FRecvdData := string(FSock.RecvPacket(0));
            if (FSock.LastError = 0) and (Length(FData)>0) then
              _LogStr('Received: ' + FRecvdData);
          end;
        if (FSock.LastError <> 0) then
          Begin
            _LogStr('Error: ' + IntToStr(FSock.LastError) + ','
+FSock.LastErrorDesc);
            Terminate;
          end;
      end;
   finally
     FSock.Free;
   end;
end;

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to