troubleshooting Question

Ping time stamping

Avatar of scprogs
scprogsFlag for United States of America asked on
Programming Languages-Other.NET ProgrammingVisual Basic.NET
10 Comments1 Solution372 ViewsLast Modified:
I have two pc's on the same network.
One of them I know the current time, the other is inaccessible by me.
I have found that you can ping another machine to get a timestamp from it.

So it would look like ...

PC1 time ping sent
PC2 time ping received
PC2 time return ping sent
PC1 time return recieved

I have the following code

Dim pingbyte(31) As Byte
        Dim timestamp As New Net.NetworkInformation.PingOptions
        PingReturn = New Net.NetworkInformation.Ping
        sReturn = PingReturn.Send("")

        Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
        Dim statistics As IcmpV4Statistics = properties.GetIcmpV4Statistics()
        MsgBox("Timestamp Requests ... Sent: " & statistics.TimestampRequestsSent.ToString & " Received: " & statistics.TimestampRequestsReceived.ToString & vbCr & "Timestamp Replies ... Sent: " & statistics.TimestampRepliesSent.ToString & " Received: " & statistics.TimestampRepliesReceived.ToString)

The message box always has 0 for sent and received ... What am I missing?
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros