-
-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timed out trying to read data from the socket stream! #122
Comments
Please send full logs in order for us to debug. Read the FAQ on how to print or save logs to a file. |
Thanks for the Response. Here are the logs:
|
When you use FileZilla does it work? Can you do this to verify and also paste the FileZilla logs here so I can compare what it does different? |
I actually can't get a directory listing through FileZilla but I can through other FTP Clients. |
Okay use another client but paste the FTP logs so we can compare with our library. |
Here is the log from Core FTP with a successful file transfer.
|
This is very similar to my issue #124, not only because of the same error message ("Timed out trying to read data from the socket stream!") but also because of ASCII vs Binary mode. In your example of a successful transfer, the type is set to ASCII prior to the upload:
In your logs of the failed transfer on the other hand, the data mode is set to Binary prior to the transfer:
|
@molekamp Amazing that you two have a similar error and thanks for debugging this use case. I will try to support ASCII transfers for the high level APIs too. |
Can you try this beta version, which has new properties ( Specifically in your case set both to use ASCII mode and that should mimic the behavior by CoreFTP. |
I had same issue here. DataConnectionType = FtpDataConnectionType.EPSV, The choice the connection type involves examinate some server response messages. Connect()Status: Connecting to *********** |
Yeah. The C# intellisense recommends this setting. So why we have to set it? |
@fschwengsbier Not sure why intellisense recommends it. By design of the original author, the library first tries EPSV then passive then gives up. Not sure why its not working in your case. |
That worked for me too after trying almost everything else. Thanks! Filezilla working on my case, and the bug only appeared while uploading to some FTP servers but not all. |
Hi, have any news? I've updates de dll version to latest and get same error. Upload big file "sql.bak" is OK, but return error in my code:
In this example i upload 2 files, the first (small) upload and check success, but second (big) upload ok but not return success. If i tried only 1 (big) still the same problem. ` Connect()Status: Connecting to :21 UploadFile("C:\sql.bak.md5", "/sql.bak.md5", NoCheck, False, None)OpenWrite("/sql.bak.md5", Binary)Command: TYPE I GetFileSize("/sql.bak.md5")Command: SIZE /sql.bak.md5 OpenPassiveDataStream(EPSV, "STOR /sql.bak.md5", 0)Command: EPSV UploadFile("C:\sql.bak", "/sql.bak", NoCheck, False, None)OpenWrite("/sql.bak", Binary)GetFileSize("/sql.bak")Command: SIZE /sql.bak OpenPassiveDataStream(EPSV, "STOR /sql.bak", 0)Command: EPSV Dispose()Status: Disposing FtpClient object... |
I have been experiencing a similar issue. My process attempts to download a 3.2Gb file every 24 hours. The first attempt after a VM restart works, but subsequent attempts eventually receive:
I disabled the swap file on the VM, and it now works consistently. |
Just putting this here because I had the same error and it took me a while before I finally found a stackoverflow question that helped me solve this issue. I tried setting the DataConnectionMode with no luck. I was trying to connect to port 990 using Explicit EncryptionMode, which doesn't work. When connecting to port 990 you MUST use Implicit EncryptionMode. Credit: https://stackoverflow.com/a/47710332/2532817 |
Fixed one of the causes of this issue in the latest : https://www.nuget.org/packages/FluentFTP/27.1.4 There were unnecessary TimeoutExceptions being thrown AFTER the file was fully uploaded/downloaded. These are now absorbed and don't cause any issue. |
FluentFTP.FtpException: Error while uploading the file to the server. See InnerException for more info. ---> System.TimeoutException: Timed out trying to read data from the socket stream! FileZilla Success log: |
Thanks a ton @aliquid for fixing this long standing issue. Gone live with 29.0.0. @JWcodeDev @molekamp @greydmar @fschwengsbier All are suggested to grab the latest version and see if it solves their problem: https://www.nuget.org/packages/FluentFTP/29.0.0 If you still see errors, decrease the |
Hello, I get the same exception (version 29.0.3). It happens after having uploaded approximatively 2.9Gb of data (series of images of around 750Kb in size).
Then I iterate the folder structure and call: Note, for some reason the log written by FluentFTP never changes as the source level filters has no effect. Even with SourceLevels.Error or SourceLevels.Critical the error is not written. Log settings used:
Tried to set NoopInterval from 5000 to 20000, no luck.
|
@inside686 This seems to be now occuring at ResumeUpload / ResumeDownload. Fix will have to be attempted. |
Hi @robinrodricks , thank you for the answer.
The problem is that, in that case, I cannot do anything on the file that was being transferred when the timeout exception occurred because it seems to be locked. |
Hi, 04/08/2020 09:02:53 Status: Connecting to xxx.xxx.xx.xxx:990 The server logs on the failed connections are all similar to the below: It fails 2/3 times when I try via the VM, the other time it successfully uploads a couple of small files (less than 2mb). I cannot reproduce the error when working within my development environment. This issue has me totally stumped. |
Just a follow up on this - we were using .net core v2 when this issue was occurring, hosted on both Linux and Windows. As an act of desperation, we re-wrote our application targeting .NET Framework 4.7 and this issue does not occur at all. |
I do have this error seems like when doing GetListing() using net core v3 Status: Disposing FtpSocketStream... |
Hi,
Code: static void Main(string[] args)
{
RunFTP();
}
static void RunFTP()
{
string hostname = "192.168.1.229";
int port = 21;
string username = "FTP_User";
string password = "123";
string fileName = @"Test/Test220.txt";
FtpClient client = new FtpClient(hostname, port, username, password);
List<FtpProfile> profile = client.AutoDetect();
client.LoadProfile(profile[0]);
client.Connect();
string[] data = GetDataFromFile(fileName, client);
Console.ReadKey();
} Tried this way: private static string[] GetDataFromFile(string _fileName, FtpClient _client)
{
try
{
return ReadLines(() => _client.OpenRead(_fileName), encoding).ToArray();
}
catch (Exception e)
{
Console.WriteLine(e);
return null;
}
}
private static IEnumerable<string> ReadLines(Func<Stream> _streamProvider, Encoding _encoding)
{
using (var stream = _streamProvider())
using (var reader = new StreamReader(stream, _encoding))
{
string line;
while ((line = reader.ReadLine()) != null)
yield return line;
}
} And this: private static string[] GetDataFromFile(string _fileName, FtpClient _client)
{
try
{
using (MemoryStream stream = new MemoryStream())
{
bool status = _client.Download(stream, _fileName);
stream.Position = 0;
List<string> data = new List<string>();
using (var reader = new StreamReader(stream, encoding))
{
string line;
while ((line = reader.ReadLine()) != null)
data.Add(line);
}
return data.ToArray();
}
}
catch (Exception e)
{
Console.WriteLine(e);
return null;
}
} Both ways works when file data don't start on "220". .Net framework 4.0 |
Does this issue still need help? Happy to work on it. |
Closing. Please open separate new issues if you encounter problems. |
PLEASE OPEN NEW ISSUES IF YOU ENCOUNTER THIS ISSUE. DO NOT ADD YOUR COMMENT HERE. WE WILL NOT DEBUG OLDER VERSIONS OF FLUENT FTP. SO ENSURE YOU ARE USING THE LATEST VERSION. |
NOTE FROM ADMIN:
This should be fixed in 29.0.0 and onwards.
But if you still have this issue, please add your post below instead of creating duplicate issues!
Thanks.
I am not able to upload a file to a FTPS site. I keep receiving the following error. If the file exists it will delete the file from the FTP but it will not upload the new file.
{"Timed out trying to read data from the socket stream!"}
Here is my code:
It errors out on the client.UploadFile line.
Seems it is in the GetRequestStream(). Not sure how to over come this error.
Thanks,
JW
The text was updated successfully, but these errors were encountered: