0 votes
by (160 points)

Hello,

I am using RebexTotalPack-2021R1 with dotNet 3.5 for a program on an WinCE 6 Computer connecting to a Filezilla Server 0.9.60 beta on a Windows Server 2019 Standard 1809.

The WinCE Computer is connected with a GSM modem to the internet. There is a VPN connection from WinCE to Win Server. I can use the VPN connection or can connect without VPN to the Filezilla Server.

The FTP Transfer (passive mode) ist starting and some kB or MB are transfered but stops after one minute with an Error in Rebex Logfile: "An existing connection was forcibly closed by the remote host".

2023-01-02 10:35:48 VERBOSE Ftp(4)[163047862] Info: Received 5948 bytes of data through data connection.
2023-01-02 10:35:48 VERBOSE Ftp(4)[163047862] Info: Checking incoming data.
2023-01-02 10:35:49 VERBOSE Ftp(4)[163047862] Info: Received 1424 bytes of data through data connection.
2023-01-02 10:35:49 VERBOSE Ftp(4)[163047862] Info: Checking incoming data.
2023-01-02 10:35:49 ERROR Ftp(4)[163047862] Info: Error while reading data: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at wsit.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
   at eeox.ywsw(Byte[] xr, Int32 xs, Int32 xt)
   at eeox.Read(Byte[] buffer, Int32 offset, Int32 count)
   at eeof.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.Ftp.pgfa(String hq, Boolean hr, Stream hs, Int64 ht, String hu, cjiq hv)
   at Rebex.Net.Ftp.pgfl(String io, String ip, Int64 iq, Int64 ir, cjiq is)
   at Rebex.Net.Ftp.GetFile(String remotePath, String localPath, Int64 remoteOffset, Int64 localOffset)
   at Rebex.Net.Ftp.GetFile(String remotePath, String localPath)
   at FtpPush.FtpRebex.GetFileFromFtp(String sourceFilename, String localDestinationFilename, Boolean isBinaryFile)
   at FtpPush.TargetFtp.DownloadFileFromTarget(FtpRebex mFt, String FileName, String distFile)
   at FtpPush.TargetFtp.DownloadFileToDirectory(String Filename, String distDIR)
   at FtpPush.TargetFtp.DownloadFileToTempLocation(String ToChFile, String tempDir)
   at FtpPush.FtpSession.DownloadSystemUpdateFromTarget(TargetFtp targt, String[] updateFileNames, Action`1 statusUpdate, UpdateReceivedDelegate updateReceived)
   at FtpPush.FtpSession.CheckForUpdatesDownloadIfValid(List`1 listOfTargets, Action`1 statusUpdate, ValidateUpdateSignalReturnFiles validateUpdate, UpdateReceivedDelegate updateReceivedDel)
   at FtpPush.FtpSession.StorageLoop()

2023-01-02 10:35:49 DEBUG Ftp(4)[163047862] Info: Data connection failed.
2023-01-02 10:35:49 DEBUG Ftp(4)[163047862] Info: Closing data connection.
2023-01-02 10:35:50 ERROR Ftp(4)[163047862] Info: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at wsit.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 count, SocketFlags socketFlags)
   at eeox.ywsw(Byte[] xr, Int32 xs, Int32 xt)
   at eeox.Read(Byte[] buffer, Int32 offset, Int32 count)
   at eeof.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Rebex.Net.Ftp.pgfa(String hq, Boolean hr, Stream hs, Int64 ht, String hu, cjiq hv)
   at Rebex.Net.Ftp.pgfl(String io, String ip, Int64 iq, Int64 ir, cjiq is)
   at Rebex.Net.Ftp.GetFile(String remotePath, String localPath, Int64 remoteOffset, Int64 localOffset)
   at Rebex.Net.Ftp.GetFile(String remotePath, String localPath)
   at FtpPush.FtpRebex.GetFileFromFtp(String sourceFilename, String localDestinationFilename, Boolean isBinaryFile)
   at FtpPush.TargetFtp.DownloadFileFromTarget(FtpRebex mFt, String FileName, String distFile)
   at FtpPush.TargetFtp.DownloadFileToDirectory(String Filename, String distDIR)
   at FtpPush.TargetFtp.DownloadFileToTempLocation(String ToChFile, String tempDir)
   at FtpPush.FtpSession.DownloadSystemUpdateFromTarget(TargetFtp targt, String[] updateFileNames, Action`1 statusUpdate, UpdateReceivedDelegate updateReceived)
   at FtpPush.FtpSession.CheckForUpdatesDownloadIfValid(List`1 listOfTargets, Action`1 statusUpdate, ValidateUpdateSignalReturnFiles validateUpdate, UpdateReceivedDelegate updateReceivedDel)
   at FtpPush.FtpSession.StorageLoop()

Filezilla Server Log shows only:

(046908)1/2/2023 10:34:34 AM - st (192.168.xxx.xxx)> 150 Opening data channel for file download from server of "/DownloadX/ST35/Update_20221204.zip.DownLoading"
(046908)1/2/2023 10:35:48 AM - st (192.168.xxx.xxx)> 426 Connection closed; aborted transfer of "/DownloadX/ST35/Update_20221204.zip.DownLoading"
(046908)1/2/2023 10:35:49 AM - st (192.168.xxx.xxx)> disconnected.

When i use TotalCommander oder Filezilla Client from Windows Server and connect to WinCE over VPN (without VPN is not possible in this direction) i can transfer files in both directions without any problem.

In Rebex Forum I found lots of issues with "An existing connection was forcibly closed by the remote host". But no answer helped me.

The Windows Server is from a customer. So I can not easily update anyhting like Filezilla.

What can be the problem? Maybe SSL or TSL?

Regards
Dominik

Applies to: Rebex FTP/SSL

2 Answers

0 votes
by (148k points)

How is the GSM connection getting established? Rebex FTP will use an existing connection if available, but unlike .NET's System.Net.WebRequest it won't keep the connection alive.

Try calling the following method before establishing an FTP connection and let me know whether it helps:

Rebex.Net.ConnectionManagement.ConnectionManager.TryConnect()
0 votes
by (160 points)

Thanks for your quick answer Lukas,

Rebex.Net.ConnectionManagement.ConnectionManager.TryConnect()
is not available. Maybe the reason is, that Rebex.Ftp is Version 2018 R2.1, not 2021 R1 as i wrote. Sorry for this.

But of course "won't keep the connection alive" can be the reason. Is there any possibility in 2018 R2.1 to keep it alive?

by (148k points)
Actually, version "2021 R1" does not even exist... However, ConnectionManager API was introduced in "2018 R3", published soon after "2018 R2.1". So perhaps give 2018 R3 a try to see whether this helps? https://www.rebex.net/https/history.aspx#2018R3
by (148k points)
Possible options to keep the connection alive without upgrading to 2018 R3 or higher:
- Perform a very simple HTTP request using System.Net.WebRequest API every 30 seconds or so.
- Write a custom .NET wrapper around WinCE connection manager API (cellcore.dll). See https://learn.microsoft.com/en-us/previous-versions/bb840031(v=msdn.10) for more information.
- Contract as to create a stand-alone .NET assembly that provides an equivalent of Rebex.Net.ConnectionManagement namespace to Rebex FTP 2018 R2.1 or older.
...