The Voice Of God
Mylictruan
- Joined
- Sep 25, 2004
- Messages
- 281
- Reaction score
- 0
Code:
Dim lipa As IPHostEntry = Dns.Resolve("www.battle.net")
Dim lep As New IPEndPoint(lipa.AddressList(0), 6112)
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Dgram, ProtocolType.Udp)
Dim msg As Byte() = Encoding.ASCII.GetBytes("17000000")
Try
' Sends datagram to the IpEndPoint specified. This call blocks.
s.SendTo(msg, 0, msg.Length, SocketFlags.None, lep)
' Creates an IpEndPoint to capture the identity of the sending host.
Dim sender As New IPEndPoint(IPAddress.Any, 0)
Dim tempRemoteEP As EndPoint = CType(sender, EndPoint)
' Creates a byte buffer to receive the message.
Dim buffer(1024) As Byte
' Receives datagram from a remote host. This call blocks.
s.ReceiveFrom(buffer, 0, 100, SocketFlags.None, tempRemoteEP)
' Displays the information received to the screen.
Console.WriteLine((" I received the following message : " + Encoding.ASCII.GetString(buffer)))
Catch e As Exception
Console.WriteLine(("Exception : " + e.ToString()))
End Try
End Sub 'SendReceiveTo4
Can you help me fix it?