Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 months ago.
Improve this question
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;
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.
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.
Related
Can anyone diagnose my failure to connect to smtp.office365.com using Delphi 2010 and Indy 10.5.5?
I have read the code examples provided by Indy expert Remy Lebeau in this question: Using INDY 10 SMTP with Office365.
I have taken each of the two alternate code samples (one using AuthType satDefault and the other satSASL) from that question and cut-and-pasted them into a console application. In each case get the following error when run:
EIdOSSLUnderlyingCryptoError: Error connecting with SSL.
Error connecting with SSL.
error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
When I change UseTLS to utUseExplicitTLS (as suggested in some other answers that state a plain text connection is required before attempting TLS) I get the following error:
EIdOSSLConnectError: Error connecting with SSL.
Error connecting with SSL.
EOF was observed that violates the protocol
I notice some references in other answers to setting SSLOptions.SSLVersions instead of SSLOptions.Method (which is said to be deprecated) but that property does not appear to exist on TIdSSLIOHandlerSocketOpenSSL in my version of Indy.
I believe I have the version of Indy which shipped with the D2010 updates but that it's somewhat out-of-date. I would be willing to update a newer version if one exists but can't seem to find anyway to do so without installing SVN, learning it, checking out from Development, and recompiling.
Finally, I've tried running all four variants of my console application with no DLLs present in the executable directory and with the DLLs from OpenSSL v1.0.2h present without any apparent effect.
EDIT: One other piece of information. The SMTP credentials supplied by the client (this project sends emails through a single dedicated outbound email address) is of the form project#myclientsdomain.com, rather than #office365.
Apparently, since Remy wrote the answer in the linked question, Office365 has stopped supporting SSLv3 (presumably to avoid a known exploit) and now requires TLS. The code from his answer in the original question works if you change these two lines:
idSMTP1.UseTLS := utUseImplicitTLS;
TIdSSLIOHandlerSocketOpenSSL(idSMTP1.IOHandler).SSLOptions.Method := sslvSSLv3;
to:
idSMTP1.UseTLS := utUseExplicitTLS;
TIdSSLIOHandlerSocketOpenSSL(idSMTP1.IOHandler).SSLOptions.Method := sslvTLSv1;
as the subject says, just close a DS App with 1 open connection and it hangs.
The issue is related to procedure TIdScheduler.TerminateAllYarns;because it get into an infinite loop trying to close all yarns.
The issue is similar to this reported by another user.
http://www.codenewsfast.com/cnf/article/0/permalink.art-ng2026q2000
Regards,
Same problem for me too. I've implemented a DataSnap CallBack example in Delphi XE3 and Delphi 10 Seattle: both hangs if one or more client are connected to the server.
But they hangs only when I close directly the server Windows application.
Try calling before:
ServerContainer1.DSServer1.Stop;
It works for me.
I have a datasnap server app developed originally with XE5 that was working fine with a client app on a mobile tablet accessing a Firebird database on a server. I have recompiled the code with XE7. The only change I had to make to the code to compile without any errors was to add DataSnap.DSProviderDataModuleAdapter to the uses of the methods unit. Have replaced the server app on the server (stop service/uninstall/reinstall/start service) and now I can no longer insert/update records in the database on the server. Whenever I reach the line of code to ApplyUpdates(0) I get the following error:
Remote Error: Access violation at address 0093CB3F in module Snackerservice.exe. Read of address 00000000.
Retrieving data from the database to display on the tablet is not a problem so the connection is working.
If I change the server app back to the one developed under XE5......all works fine again. The other strange thing is that there are no problems with the XE7 compiled app when using 'localhost' to access a copy of the database on my development machine......only when accessing through an IP connection to a server.
Can someone please help me solve this frustrating problem.
Bill Zwirs
To hopefully make it a little clearer, here is a bit of code that causes the issue:
iLic := ServerMethodsClient.Get_Licences;
iDev := ServerMethodsClient.Get_NumDevices;
if (iDev < iLic) then
begin
iDevID := ServerMethodsClient.Get_NewDevID;
MobClientDM.DevicesClient.Open;
MobClientDM.DevicesClient.Insert;
MobClientDM.DevicesClientDEVID.AsInteger:= iDevID;
MobClientDM.DevicesClientMACADDRESS.AsString := sMacAddress;
MobClientDM.DevicesClient.Post;
if (MobClientDM.DevicesClient.ChangeCount > 0) then
MobClientDM.DevicesClient.ApplyUpdates(0); ....................Error occurs here
end;
Problem solved at last.
When I installed the server app on the server I also added Midas.dll to the directory which worked fine until I compiled with XE7. So I have now included MidasLib in the uses clause of the server app and removed the Midas.dll file from the install directory. Compiled and installed and all works good again.
Hope this helps others who might have a similar problem.
Bill Zwirs
Hi i am trying to use TMS software to download a file. But cannot seem to get the file to download.
i use the following code, and have written in an exception handler which keeps telling me that the URL cannot be found. Any help would be appreciated.
main.WebCopy1.Items.Clear;
with main.WebCopy1.Items.Add do
begin
FTPHost :=fHost;
FTPUserID := fusername;
FTPPassword := fPass;
URL := '\Setup\libmysql.dll';
Protocol := wpFTP;
CopyNewerOnly := true;
TargetDir := 'c:\Program Files\myfolder\';
end;
main.WebCopy1.Execute;
May i just add, i just tested the same code and url in another project that i had written and it worked.
Thank You
Things I would try:
use the debugger and check the code which connects and sends the HTTP request
check your HTTP server log file to see which resource has been requested
use a HTTP proxy (Fiddler) to intercept and analyze the HTTP traffic between the Delphi application and your HTTP server
extract the relevant part of the two projects, then diff their sources
(both with the working and the non-working application).
Sorry guys i found the problem. The connection was not set to passive.
I checked on the server and could not find that any connection was being made to the ftp account, and realized that the problem was not the path, it was the connection.
So i checked and saw the connection was set to passive, changed it an vualla, it worked.
So Now We know, For it to work passive must be set to true.
Thanks alot anyway guys
I am facing an issue in my windows7 32bit Pc(on i3).I have Outlook 2010 and Delphi 7 on it.
I am using following code to detect Outlook is running or not.
ClassID := ProgIDToClassID(ClassName);
Result := (GetActiveObject(ClassID, nil, Unknown) = S_OK);
This fails, ie, result become false and yet in other PCs this working fine.
The error I'm getting is MK_E_Unavailable.
Update:
May be it just happening with me only.
procedure TForm1.Button1Click(Sender: TObject);
function IsObjectActive(ClassName: string): Boolean;
var
ClassID: TCLSID;
Unknown: IUnknown;
begin
try
ClassID := ProgIDToClassID(ClassName);
Result := (GetActiveObject(ClassID, nil, Unknown) =S_OK );
except
Result := False;
end;
end;
begin
if IsObjectActive('Outlook.Application') Then
ShowMessage('OutLook is there.')
else
ShowMessage('OutLook is not there.')
end;
Plz note OL is running and
When I am running the created exe, I am getting message "OutLook is there".
when I am running from Delphi IDE, I am getting Message 'OutLook is not there.'
This happens always, I am using Delphi 7 on Windows 7, running with Run as Admin. Kindly tell me why this happening and how can I fix this.
What's the issue of Delphi 7 on Windows 7.
Please suggest.
Here's the entry for GetActiveObject.
http://msdn.microsoft.com/en-us/library/a276e30c-6a7f-4cde-9639-21a9f5170b62%28VS.85%29
If you want to decode the error, you need to find out what the HResult means.
Wikipedia has a link to a ERR.EXE utility from MS that will translate the HResult code into an error description. For COM HResults see: http://matthewbass.com/2005/11/15/decoding-com-hresult-error-codes/.
note the download link in the article is broken, here's a working link: http://www.softlookup.com/display.asp?id=7113
Once you know what the error is, update the question.
If you want to know whether a process is running without using OLE, see: How to check if a process is running using Delphi?
Another option might to use FindWindowEx to check for Outlook 2010 specific windows.
You can use WinID (a spy++ clone) to see the windows used by Outlook 2010.
I was facing the same issue and I found the solution.
It's simple, If Outlook is already running, it MUST have the same rights as the process that is trying to use it.
In simple words, if you are running Outlook with admin rights, you must execute your app with admin rights.
Your problem must be that you are running Outlook without admin rights, and Delphi IDE with admin rights. So when you are launching your app from within IDE, the rights doesn't match, and you get the error. This is why when running your app outside the IDE it works as expected. Because outside IDE your app runs without admin rights.
Try to match the rights. This is something to take into account for the end user environment too.
Also, the UAC under Windows Vista and later is known to cause multiple issues with these type of things. If everything else fails, disable UAC (User Account Control, you will find it under your account options) and see what happens.
try to use rctrl_renwnd32
try this:
(FindWindow('rctrl_renwnd32', nil) <> 0)
http://users.skynet.be/am044448/Programmeren/VBA/vba_class_names.htm