Hi everyone
I have a little problem with a socket that i'm using to get the current date and time for an serve, i can send the request, but i don't receive anything.
The current code:
vb.net Code:
Dim sock As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp) Dim ip As Net.IPHostEntry = Net.Dns.GetHostEntry("time-a.nist.gov") Dim iep As New Net.IPEndPoint(ip.AddressList(0), 123) sock.Connect(iep) If sock.IsBound Then Debug.WriteLine("Connected...") sock.SendTimeout = 3000 sock.ReceiveTimeout = 15000 Dim bytesSent As Integer = sock.Send(SNTPData) Dim bytesRec As Integer = sock.Receive(SNTPData)
The SNTPData has the correct size and the correct format.
The timeout and the error:
What i'm missing here?A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
THanks




Rate People That Helped You
Reply With Quote