C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Network »

Ping a computer and send file to remote host


Posted Date: 08 Mar 2007    Resource Type: Code Snippets    Category: Network
Author: Balamurali BalajiMember Level: Diamond    
Rating: 1 out of 5Points: 10



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");
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Find IP Address of the computer
Previous Resource: Building a Simple File download server using C#
Return to Discussion Resource Index
Post New Resource
Category: Network


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use