SSH.NET TimeOut doesn't work above a certain time frame
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 4.4k
- Fork
- 993
- Merge medio
- 9g 21h
- PR unite (30g)
- 1
Descrizione
I am using SSH.NET library to create sftp client. I need to resume the download if network connection becomes available again within this timeout. I am using the below mentioned approach as shown in many examples.
PrivateKeyFile ObjPrivateKey = new PrivateKeyFile(keyStream);
PrivateKeyAuthenticationMethod ObjPrivateKeyAutentication = new PrivateKeyAuthenticationMethod(username, ObjPrivateKey);
var connectionInfo = new ConnectionInfo(hostAddress, port, username, ObjPrivateKeyAutentication);
try
{
using (var client = new SftpClient(connectionInfo))
{
client.ConnectionInfo.Timeout = TimeSpan.FromSeconds(10);
client.Connect();
if (!client.IsConnected)
{
return false;
}
if (!client.Exists(source))
{
return false;
}
var fileName = Path.GetFileName(source);
using (var fs = new FileStream(destination + fileName, FileMode.Create))
{
client.DownloadFile(source, fs, printActionDel);
fs.Close();
returnState = true;
}
client.Disconnect();
client.Dispose();
}
}
I am unplugging the network cable to interrupt the download and test the timeout scenario. Though i enable the internet connection again within the timeout to resume the download, it is not resuming. Am i missing something here.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Il report si concentra su SftpClient, ConnectionInfo.Timeout e DownloadFile; inizia riproducendo l’interruzione del cavo di rete con un timeout di 10 secondi e traccia il modo in cui viene gestito il ripristino della connessione. Cerca l’implementazione del timeout e del download SFTP, insieme ai test correlati, quindi stabilisci il comportamento previsto quando la connettività viene ripristinata prima della scadenza del timeout.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100