Topic "How to test if the connection was successfull ?"

Author Message
sorcer1

Guest


hello,

i want to know if my connection was successfull.

how can i do this ?

thank you
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Can you give us more details about your use case?
_________________
Martin Prikryl
Guest




yes of course! Wink
this my .net (c#) code :

Code:

Process m_WinSCP = new Process();
m_WinSCP.StartInfo.FileName = "WinSCP.com";
m_WinSCP.StartInfo.UseShellExecute = false;
m_WinSCP.StartInfo.RedirectStandardInput = true;
m_WinSCP.StartInfo.RedirectStandardOutput = true;
m_WinSCP.StartInfo.CreateNoWindow = true;
m_WinSCP.Start();

m_WinSCP.StandardInput.WriteLine("option batch abort");
m_WinSCP.StandardInput.WriteLine("option confirm off");
m_WinSCP.StandardInput.WriteLine("open ftp://127.0.0.1");
m_WinSCP.StandardInput.WriteLine("put myfile.txt");
m_WinSCP.StandardInput.Close();
m_WinSCP.WaitForExit();

if (0 == m_WinSCP.ExitCode)
{
  //success
}


it's work great, i can upload and download.
but when i open a sesssion how can i know before upload or download if my session is active ?

thanks for your help.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Well, "put" fails if session is not open. So the check you have there is enough.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License