Jump to content
Harald_TSE

Problem in the Do_FD_CONNECT method in OverbyteIcsWSocket

Recommended Posts

Hello,
we have recently been using the TCP/IP Client Socket in the current version 9.1 for real-time data evaluation. Everything works fine except for a problem in the "Do_FD_CONNECT" method in OverbyteIcsWSocket.pas:
The status wsConnected is always set, even if a connection to the server could not be established, i.e. if the ErrorCode from msg.LParam is not equal to 0.

To work around the problem, we modified the method as follows:

if FState <> wsConnected then
begin
  if IcsHiWord(msg.LParam) = 0 then // query added!
    ChangeState(wsConnected);
  TriggerSessionConnectedSpecial(IcsHiWord(msg.LParam));
  if (IcsHiWord(msg.LParam) <> 0) and (FState <> wsClosed) then
    Close;
end;

Normally this probably doesn't matter that much because the "Close" changes the connection status again, but we need the correct status immediately.
Is there anything wrong with officially committing this change to the repository?

Share this post


Link to post

Thanks, I've made the change in my copy, but it won't be in SVN for several days until I see if it breaks anything. 

 

Generally, applications use specific events like onSessionConnected, Closed, etc to check for errors, rather than the State changing.  But if this change proves not to be backward compatible, it will be reverted.

 

ICS itself does not use the OnChangeState event, except for when a server starts listening. 

 

Angus

 

Edited by Angus Robertson

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×