I have some really old code that was compiled with the version of Indy10 that was included in Delphi 2007. Having recompiled this in Delphi 11.1 the TCP Clients that should connect to the server application no longer do so. I'm trying to connect to the server using 127.0.0.1 on port 50000. Instead I get "connection timeout" or "socket operation on a non-socket" errors.
Is there any documentation anywhere that details what has changed between Indy10 in Delphi 2007 and Delphi 11.1? All the links on the Indy Project website are broken so I haven't found anything there. According to the Log at the start of IdTCPClient.pas there are no changes between the two however a quick file comparison reveals quite a few changes including the change of Port value from Integer to TIdPort. I've recompiled our server application in Delph11.1 and it will accept connections from older clients compiled in Delphi 2007 but not from new clients (hence I suspect changes IdTCPClient may be giving me issues). Thanks in advance for any help.
The code that tries to open the connection is below;
function TClientServer.Connect(SuppressMsg : Boolean) : Boolean;
begin
Result := False;
if (FRunning = False) and (Connecting = False) then
begin
try
TCPClient.ConnectTimeout := FConnectTimeout;
Connecting := True;
if assigned(TCPClient.IOHandler) then
begin
TCPClient.IOHandler.ConnectTimeout := FConnectTimeout;
TCPClient.IOHandler.MaxLineAction := maSplit;
end;
TCPClient.Connect;
Result := True;
except on E : Exception do
begin
Connecting := false;
if SuppressMsg = False then
begin
{ Look at cycling through the servers in the FCoreServer list }
{ until we manage to connect to one. Perhaps we need to prompt }
{ the user to select the machine to connect to ? }
ShowMessage('Failed to connect to the core server !' #13#10#10
'Please ensure server is running at address '
TCPClient.Host ' (' IntToStr(TCPClient.Port) ')' #13#10 E.Message );
end;
end;
end;
end;
end;
CodePudding user response:
Having recompiled this in Delphi 11.1 the TCP Clients that should connect to the server application no longer do so. I'm trying to connect to the server using 127.0.0.1 on port 50000. Instead I get "connection timeout" or "socket operation on a non-socket" errors.
I know for a fact that Indy works on localhost, so the problem has to be with either your setup or your environment. But you did not provide any details about either one.
Is there any documentation anywhere that details what has changed between Indy10 in Delphi 2007 and Delphi 11.1?
There is Indy's blog that describes some of the more user-facing changes that have been made over time. But for more detailed changes, you would have to look at the source code change history in Indy's GitHub repo.
All the links on the Indy Project website are broken
Known issue: https://www.indyproject.org/2021/02/10/links-to-old-indy-website-pages-are-currently-broken/ I just haven't had any time to fix it yet.
According to the Log at the start of IdTCPClient.pas there are no changes between the two
The change logs that are stored in the source files themselves are very old. They are leftovers from when Indy used TeamCoherence as its VCS many years ago. When Indy switched from TC to SVN (and then later to GitHub), new change logs are no longer stored in the source file themselves. I've been wanting to either remove the old logs, or put a final "these are old" comment in them, for a long time.
I've recompiled our server application in Delph11.1 and it will accept connections from older clients compiled in Delphi 2007 but not from new clients (hence I suspect changes IdTCPClient may be giving me issues).
I am not aware of any changes that would be breaking the connection. It should be working fine. But, without seeing your setup and environment, there is no way to know what could possibly be preventing the connection.
CodePudding user response:
I finally found the problem; the changes to Indy10 are a red herring. My project was using FastMM in several units and for some strange reason when I commented out all instances it worked! The client now happily connects to the server. @RemyLebeau - thanks so much for all your help with this and quite a few other questions I've posted over the last few months.