IPAddress.Parse(CType(s.RemoteEndPoint, IPEndPoint).Address.ToString())
In which s = your socket?
l8tr - Chris
"Jesse Zan" <jz...@hotmail.com> wrote in message news:<#yCl3geM...@TK2MSFTNGP10.phx.gbl>...
Jesse -
It depends on how the UDP socket was created on the local
computer. If you use the UdpClient class, it would look like:
Dim iep as New IPEndPoint(IPAddress.Any, 9050)
Dim sock as New UdpClient(iep)
Dim iep2 as New IPEndPoint(IPAddress.Any, 0)
Dim data as byte()
data = sock.Receive(ref iep2)
Console.WriteLine("The remote host is: {0}, port {1}", _
iep2.Address, iep2.Port);
If you use the Socket class, it would look like:
Dim iep as New IPEndPoint(IPAddress.Any, 9050)
Dim sock as New Socket(AddressFamily.InterNetwork, _
SocketType.Dgram, _
ProtocolType.Udp)
sock.Bind(iep)
Dim iep2 as New IPEndPoint(IPAddress.Any, 0)
Dim sender as EndPoint
Dim data as byte()
Dim recv as int
sender = (EndPoint)iep2
recv = sock.ReceiveFrom(data, ref sender)
Console.WriteLine("The remote host is: {0}", sender.ToString())
Hope this helps out some.
Rich Blum
Author of "C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176