Ping a computer and send file to remote host


In this article I explaining about how to Ping a computer and send file to remote host with code behind

This sample code shows how to ping a remote computer in the network and send a file to the remote computer. This example is shown as a console application which asks the user to type the name of remote compuetr and name of the file to be uploaded to the remote host. Then it uses the UploadFile method of the network class to transfer the file to the remote machine.


Console.Write("Enter the remote computer name:");
string remoteHost = Console.ReadLine();

Microsoft.VisualBasic.Devices.Computer c = new Microsoft.VisualBasic.Devices.Computer();
if (c.Network.Ping(remoteHost, 1000))
{
Console.WriteLine("The specified computer {0} is successfully pinged", remoteHost);
Console.Write("Enter the remote computer folder fullpath:");
string remotepath = Console.ReadLine();
Console.Write("Enter the local filename with fullpath:");
string localfile= Console.ReadLine();

c.Network.UploadFile(localfile, new System.Uri(remotepath).AbsoluteUri);

Console.WriteLine("The specified file is successfully uploaded");
}


Comments

Guest Author: Nurcan19 Mar 2012

I've used the product pralirimy to transfer files between two computers via the USB cable connection. The file transfer itself works fine, but the file selection process seems to be limited to folders only. The selections can not be made down to the file level. If you have a large folder with many files, you either have to deal with all of them or none of them.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: