나는 Kellerman .NET SFTP Library을 사용하고 있으며 그 중 하나의 방법으로 고민 중입니다. 내가 연결이 백업 후 파일 업로드를 다시 시작이 메서드를 호출 할 수 documentation에 따르면연결이 다시 시작된 후 파일 업로드 재개
ResumeUploadFileAsync (Method)
.
은 어쩌면의 개념을 오해하고있어sftp.ResumeUploadFileAsync("c:\\uploadfile1.txt", "uploadfile1.txt");
ResumeUploadFileAsync
하지만 인터넷 연결을 잃고는 최대 몇 분 내가 원하는 만약 내가 달성 노력하고있어 업로드 중입니다에서 업로드를 시작하는 내 응용 프로그램 그것은 떠났다.저는 이것을 C# 콘솔 응용 프로그램에 작성했습니다. 내가 무슨 일이 일어나고 있는지 볼 수 로깅을 사용하도록 설정 한
public static void uploadToSFTP() { try { SFTP myConnection = new SFTP(); myConnection.EnableLogging(); myConnection.HostAddress = "tt-sftp"; myConnection.UserName = "username"; myConnection.Password = "pwd"; myConnection.CurrentDirectory = "sam"; myConnection.Connect(); //upload file myConnection.UploadFileAsync(yesterdaysZipFile, localZipFileName); bool isConnected = false; while (myConnection.IsBusy == true) { //PRINT HOW LONG REMAINING FROM UPLOAD if (myConnection.IsConnected == true) { Console.WriteLine(myConnection.EstimatedTimeRemaining); } else { //check for connection while (isConnected == false) { if (myConnection.IsConnected == true) { //resume the upload myConnection.ResumeUploadFileAsync(yesterdaysZipFile, localZipFileName); while (myConnection.IsBusy == true) { Console.WriteLine(myConnection.EstimatedTimeRemaining); } isConnected = true; } else { isConnected = false; } } } } List<FTPFileInfo> _files = myConnection.GetDirectoryListing(); //there's more code here but it never gets to this point } catch (Exception ex) { Console.WriteLine(ex.ToString()); }
:
이것은 내가했다 접근법이다.
인터넷 연결이 끊어지면 이해할 수없는 다음 오류가 발생합니다.
메시지 : System.Net.Sockets.SocketException (0X80004005)은 : 이러한 호스트는 자신의 를 KN하지
다음내 인터넷 연결을 다시 사용하고 이것이 내가 무엇을 얻을 수 있습니다 :
열고 "** @의 TT-SFTP를"22
0 연결
패스 : **
0 암호 허용
ReconnectRetry : 힘이 성공적으로
ResumeUploadFileAsync \의 TT-전자를 연결 \ CompressedArchive 20140926 \ 20140926.zip,
20140926.zip ReconnectRetry \ : 서버와의 연결이 끊어져 비밀번호가 성공적으로
분리
0
GetFileSize 20140926 .ZIP
열기 "** @의 TT-SFTP를"22
0 연결
패스 : **
0 비밀번호 행 cepted
ReconnectRetry : 다시 연결에 성공
PWD
0 현재 디렉토리입니다 : "/"
CD/SAM
CD/SAM
0 디렉토리는/이제 샘
입니다 합계 20140926.zip
0 디렉토리 지금/샘
0 크기 0
0시 0분 0초
0시 0분 0초
메시지 : KellermanSoftwar : 파일을 열 수 없습니다에게 소스를 수 이자형.NET - SFTP - 도서관 대상 사이트 : 스택 추적 : KellermanSoftware.NetSFtpLibrary.Implementation.ChannelSf tp.put (의 InputStream의 SRC, 문자열 DST, SftpProgressMonitor 모니터, INT32 모드) 에서의 KellermanSoftware.NetSFtpLibrary.Implementation.ExternalSFTPChannel.PutBin ary (스트림 localStream, String remoteFileName, Int64 restart, IFireProgress fire 진행)
GetDirectoryListing sam/
ls. sam/SFTP로 이동하면 실제로 .zip 파일이 표시되지만 내부에 하나의 파일 만 포함되어 손상됩니다. SFTP Client FileZilla를 사용하여 파일을 보거나 다운로드 할 수 없습니다.
내 접근 방식을 사용하여이 문제를 해결할 수있는 방법에 대한 제안이나 인터넷 연결이 다시 백업 될 때 업로드를 다시 시작할 수있는 더 쉬운 방법이 있습니까?
감사합니다.