473,508 Members | 3,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using the timer within a PING function

11 New Member
I am new to VB.NET and I want to implement a timer function into a PING, below is the code which I am using to PING an ip address. I want the PING to be executed something like every 10 seconds, so that it updates a lablel.

Any ideas how to do this?


Dim ping As New System.Net.NetworkInformation.Ping

Dim options As New System.Net.NetworkInformation.PingOptions
options.DontFragment = True

Dim data As String = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Dim buffer As Byte() = System.Text.Encoding.ASCII.GetBytes(data)

Dim pingreply As System.Net.NetworkInformation.PingReply
Dim a() As Byte = {CInt(192), CInt(168), CInt(I0), CInt(5)}
Dim IP As New System.Net.IPAddress(a)

pingreply = ping.Send(IP, 120, buffer, options)

If pingreply.Status.ToString = "TimedOut" Then
Feb 24 '08 #1
2 1748
foster99
11 New Member
Ah.. I didn't realise how simple a timer was, i had been playing with loops for ages.

drag the timer function onto the form, create a subclass with whatever you want to execute in the timer inside it, put the name of the subclass behind the timer.
Feb 28 '08 #2
Plater
7,872 Recognized Expert Expert
Yeah hehe the timer objects are nice that way.
Attach an event handler the Tick event of windows forms timer, set the interval and enable it and you are like done.
Feb 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1984
by: Alex Fitzpatrick | last post by:
Just by way of introduction, I'm currently the principal developer and maintainer of the a JavaScript editor plug-in for Eclipse. https://sourceforge.net/projects/jseditor/ The plug-in as it...
2
2054
by: karunakar | last post by:
Hi All I dont want to expire the applicatoion Once login the application i dont want to expire the application Presently iam doing using cookies this is not working fine Please help me out ...
18
3229
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep...
0
7750
by: Ed | last post by:
I've attached some VB.NET code I've hacked together (some taken from MS examples & newsgroup postings) that will perform a ping or IcmpSendEcho using the icmp.dll (see this for more info:...
10
1566
by: Ryan | last post by:
I'm creating a website that monitors the status of servers using My.Computer.Network.Ping. I'm looking for a way to fire off my Ping() function every second or so. I see a Timer control...
5
5537
by: Michael M. | last post by:
I have the following code (listed at bottom of post) that pings a small range of IP address to see which ones are alive. To speed things up a little I am trying to use more than one thread,...
9
6456
by: Phoe6 | last post by:
Hi all, Consider this scenario, where in I need to use subprocess to execute a command like 'ping 127.0.0.1' which will have a continuous non- terminating output in Linux. # code # This...
10
1889
by: Evan Charlton | last post by:
Hey all, I'm having some trouble with window.setInterval() within a custom object/prototype. Here is my code: function MyClass() { // do some junk // ... // define methods this.m_one =...
1
2082
by: shawnwperkins | last post by:
Hi Guys, I'm new to Javascript and have a couple of questions that I hope someone could quickly answer for me. First, I'm trying to modify an example Ajax script to fit my needs. The script...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.