How to test if the connection was successfull ?

Advertisement

sorcer1
Guest

How to test if the connection was successfull ?

hello,

i want to know if my connection was successfull.

how can i do this ?

thank you

Reply with quote

Advertisement

Guest

yes of course! ;)
this my .net (c#) 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.

Reply with quote

Advertisement

You can post new topics in this forum