How do you choose the fastest server from a DNS?
VB Code:
Public Class SocketMaster
Public Event OnConnect()
Public Event OnDisconnect()
Public Event OnError(ByVal Err As SocketException)
Private Socket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Public Sub Connect(ByVal server As String, ByVal port As Integer)
Dim hostEntry As IPHostEntry = Nothing
Dim address As IPAddress
Try
hostEntry = Dns.Resolve(server)
For Each address In hostEntry.AddressList
Dim endPoint As New IPEndPoint(address, port)
Socket = New Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Try
Socket.Connect(endPoint)
If Socket.Connected = True Then
RaiseEvent OnConnect()
Exit For
End If
Catch Err As SocketException
RaiseEvent OnError(Err)
End Try
Next address
Catch Err As SocketException
RaiseEvent OnError(Err)
End Try
End Sub
Public Sub Disconnect()
Try
Socket.Close()
RaiseEvent OnDisconnect()
Catch Err As SocketException
RaiseEvent OnError(Err)
End Try
End Sub
End Class
This is my socket class
When you DNS like www.google.com and it gives you a list of address's, i want to ping each one to find the fastest, however i am unsure of how to do this.
Re: How do you choose the fastest server from a DNS?
Does anyone know how to ping a server?
Re: How do you choose the fastest server from a DNS?
Re: How do you choose the fastest server from a DNS?
Re: How do you choose the fastest server from a DNS?
The C# Examples, one didn't work
The other wasn't exactly what i wanted
The VB link was a little confusing, why was it VB6 Code?