To simulate the problem, use the TCPView tool to close the connection once the StompClient is connected. To solve the problem I just added a try..except. Because de function fails, I can't use method Disconnect to force a new connection.
TCPView.zip
OBS: I'm not use Synapse
function TStompClient.Connected: boolean;
begin
try
{$IFDEF USESYNAPSE}
Result := Assigned(FSynapseTCP) and FSynapseConnected;
{$ELSE}
// ClosedGracefully <> FTCP.Connected !!!
Result := Assigned(FTCP) and FTCP.Connected and (not FTCP.IOHandler.ClosedGracefully);
{$ENDIF}
except
Result := False;
end;
end;
To simulate the problem, use the TCPView tool to close the connection once the StompClient is connected. To solve the problem I just added a try..except. Because de function fails, I can't use method Disconnect to force a new connection. TCPView.zip
OBS: I'm not use Synapse
function TStompClient.Connected: boolean; begin try {$IFDEF USESYNAPSE} Result := Assigned(FSynapseTCP) and FSynapseConnected;
{$ELSE} // ClosedGracefully <> FTCP.Connected !!! Result := Assigned(FTCP) and FTCP.Connected and (not FTCP.IOHandler.ClosedGracefully); {$ENDIF} except Result := False; end; end;