TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
fmcquaid
NA
9
0
PingTest Problem
Sep 9 2004 3:56 PM
I copied this code off the internet. It compiles fine but when I run it, I get the error below. I am running a Windows 2000 machine and using Microsofts Visual C# 2005 Beta. Thanks for any help you can give me!! Error message: System.Net.NetworkInformation.PingException: An exception occurred during a Ping request. ---> System.EntryPointNotFoundException: Unable to find an entry point named 'IcmpCreateFile' in DLL 'iphlpapi.dll'. at System.Net.NetworkInformation.UnsafeNetInfoNativeMethods.IcmpCreateFile() at System.Net.NetworkInformation.Ping.InternalSend(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options, Boolean async) at System.Net.NetworkInformation.Ping.ContinueAsyncSend(Object state) --- End of inner exception stack trace --- I looked for the 'iphlpapi.dll' and it is in the WINNT\system32 directory. Here is the code: namespace PingTest { partial class Form1 : Form { public Form1() { InitializeComponent(); } public void StartPingButton_Click(object sender, EventArgs e) { Ping pingSender = new Ping(); pingSender.PingCompleted += new PingCompletedEventHandler(PingCompletedCallback); string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes(data); int timeout = 12000; PingOptions options = new PingOptions(64, true); richTextBox1.Text = "Time to Live: " + options.Ttl + "ms" + "\r\n" + "Dont Fragment: " + options.DontFragment; pingSender.SendAsync(textBox1.Text, buffer, timeout, options); }//end StartPingButton public void PingCompletedCallback(object sender, PingCompletedEventArgs e) { if (e.Cancelled) { richTextBox1.Text = "Ping Cancelled."; } if (e.Error != null) { richTextBox1.Text = "Ping Failed. " + "\r\n" + e.Error.ToString(); } PingReply reply = e.Reply; if (reply.Status == IPStatus.Success) { richTextBox1.Text = "Address: " + reply.Address.ToString(); } }// end pingcompletedcallback private void ResetButton_Click(object sender, EventArgs e) { Application.Exit(); } }//end Class Form }//end namespace
Reply
Answers (
2
)
WebBrowser and IE
VB.NET Help Next Record and formatting