C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Ping a computer and send file to remote host


Posted Date: 08 Mar 2007    Resource Type: Code Snippets    Category: Network

Posted By: Balamurali Balaji       Member Level: Diamond
Rating:     Points: 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  
(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!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use