Skip to content

Function Connected not working when connection was closed unexpectedly #36

@ronaldobim

Description

@ronaldobim

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions