|
-
Jan 17th, 2005, 08:11 AM
#1
Thread Starter
Hyperactive Member
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.
-
Jan 17th, 2005, 11:26 AM
#2
Thread Starter
Hyperactive Member
Re: How do you choose the fastest server from a DNS?
Does anyone know how to ping a server?
-
Jan 17th, 2005, 11:46 AM
#3
Re: How do you choose the fastest server from a DNS?
-
Jan 17th, 2005, 11:54 AM
#4
Re: How do you choose the fastest server from a DNS?
"The dark side clouds everything. Impossible to see the future is."
-
Jan 17th, 2005, 01:01 PM
#5
Thread Starter
Hyperactive Member
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|