w0wbagger 3 Posted October 6 I was finally able to compile and install ICS 9.3 for C++ Builder 12.2, and while I was able to compile and run the (delphi, .dproj) SslFTPServer demo, when I create a new C++ Builder project and place a TFTPServer (Not an TSslFTPServer) component on the form, I can connect to it using a regular ftp client, but the connection doesn't seem to "Return". That is, I can't enter a subsequent command like USER or PASS. Even though I've compiled the ics library with debug info, I can't seem to debug into overbyteicsftpSrv,pas just OverbyteicsWsockets.pas. I know there aren't a lot of C++ Builder users here, but I can't think of why something would compile and run with the libs I installed in C++ Builder as a .dproj, I can't build a simple C++ App (literally 1 component on a form). Might anyone have an idea? Thanks. Share this post Link to post
Angus Robertson 574 Posted October 6 The ICS low level debugging in not really designed for protocols, but SSL handling. You should add your own logging in the various FTP events, as the Delphi sample does, so you know exactly what stage of the session it stalls. Angus Share this post Link to post
w0wbagger 3 Posted October 6 I'll try. It's strange. I wrote two apps, one with the TFtpClient component, one with the TFtpServer component. If I use the *updated* client app with the *old* TFtpServer app (the one written with 8.7, the last time I was able to compile ICS in C++ Builder), it works fine. As soon as I try replacing the old TFtpServer App with the new one, it stops. I was logging ClientConnect in the new version, and noticed that when it's called, the PeerAddr is NULL. Something must have changed. I'll check the changelogs to see if I can pinpoint what's happened, but as of now, I'd say TFtpServer is not backwards compatible in C++ Builder, while TFtpClient still works correctly (8.7->9.3).. I'll try using an sslFTPServer component and see if I have any better luck, too. Just writing these in case anyone else is trying to get this working in C++ Builder. Share this post Link to post
w0wbagger 3 Posted October 7 It calls OnClientConnect, and I am able to enter some log entries there (although as I mentioned, Client->GetPeerAddr() returns '' in it). But then, nothing. My understanding of the component is it should then send a request for User/Pass, but it doesn't seem to get to this point. Is there some other trigger between connect and the Banner/request for User that I might trap to log? Here's what inspecting the Client * looks like in OnClientConnect. It looks...incomplete? ftpState is ftpcWaitingUserCode, but on the client side, control hasn't returned to me to enter USER or PASS. Does this suggest an issue at a lower-level function? Share this post Link to post
Angus Robertson 574 Posted October 7 The FTP server never sends command, only responses to commands from the client. Each response starts with a three digit number, so once connected the server will send one or more lines like: Connect/Logon to FTP Server: magpub5.magsys.co.uk:21 < 220-magpub5.magsys.co.uk < 220-Magenta File Server Release 2.9/ICS V9.3 - 16th September 2024 < 220-ICS TFtpServer (c) 1998-2023 F. Piette V9.1 < 220 Server: MAGPUB5 at 2024-10-03T17:39:18 The client should then respond with one of several commands, HOST, USER, TLS, FEAT, etc. If you can not build the Delphi FTP sample OverbyteIcsSslMultiFtpServ.dproj, I suggest you download and run the prebuilt version from https://wiki.overbyte.eu/arch/icsdemos-servers.zip and have your client connect to it, see what happens. Or look at whatever logs your client produces,. Or use the ICS Xfer sample to connect to your C++ server and look at the log. Angus Share this post Link to post
w0wbagger 3 Posted October 7 (edited) Thanks Angus, I'll try your suggestions now. The server never responds with the "Welcome" lines. it does trigger a "ConnectClient" event, (I can log this okay), but then never returns control to my ftp session to allow me to enter a USER command. Will let you know how I get on with your suggestions, thanks. Edited October 7 by w0wbagger Share this post Link to post
w0wbagger 3 Posted October 14 (edited) Have to give up on this for now. TFTPServer and TSslFTPServer do not seem to work for me in C++ Builder. I can compile and run the .dproj demo (it works correctly), but cannot create the simplest native C++ Builder app with either component. It connects (triggers OnClientConnect), but then hangs. I can't seem to debug into the .pas source, so can't figure out why. The fact I can run the .dproj sample program okay would indicate to me that the .lib file is correct, and it must be something about how the .hpp files are generated that somehow screw it up? Anyway, if there's anyone else using C++ out there, I've sent Angus some updates for the package directory .proj files that make the library compilable. Maybe the other components work, but T(Ssl)FTPServer doesn't seem to, unfortunately. Here's what the ICSLogger captured: 21:54:04:484 054684F0 Listening 21:54:04:499 SslFtpServer1 started 21:54:13:060 054684F0 Do_FD_ACCEPT handle=1632 21:54:13:063 08B427E0 Client Connect Error - No Error (#0) -1 21:54:35:908 054684F0 SocketCloseCalled handle=1632 21:54:35:910 054684F0 TCustomWSocket.Shutdown 1 handle=1632 21:54:35:913 054684F0 ResetSslSession starting handle=-1 21:54:35:921 ResetSslSession SetShutDown FSsl handle=0 21:54:35:927 ResetSslSession FSslBio handle=0 21:54:35:928 ResetSslSession FNBio handle=0 21:54:35:929 ResetSslSession Fibio handle=0 21:54:35:929 ResetSslSession Close FSsl handle=0 21:54:35:940 054684F0 ResetSslSession Done 21:54:35:940 SslFtpServer1 stopped and here's the client side log: . 2024-10-13 21:54:13.059 Session upkeep . 2024-10-13 21:54:13.099 Connecting to 127.0.0.1 ... . 2024-10-13 21:54:13.099 Connection pending . 2024-10-13 21:54:13.099 Connected with 127.0.0.1. Waiting for welcome message... . 2024-10-13 21:54:28.748 Timeout detected. (control connection) . 2024-10-13 21:54:28.748 Connection closed . 2024-10-13 21:54:28.748 Connection failed. . 2024-10-13 21:54:28.748 Got reply 1004 to the command 1 * 2024-10-13 21:54:28.809 (EFatal) Connection failed. * 2024-10-13 21:54:28.809 Timeout detected. (control connection) * 2024-10-13 21:54:28.809 Connection failed. Edited October 14 by w0wbagger Added Logs Share this post Link to post