Hello Ragnvald,

You could cast the RemoteEndPoint to a IPEndPoint, that way you'll
have access to the Address property.

Best regards,
Joao Paulo Carreiro


Friday, August 12, 2005, 9:47:41 AM, you wrote:

> How do I get the remote IP address from a socket?
> I know could use socket.RemoteEndPoint.ToString(), extract the IP part of
> it, and create an IPAddress using the Parse method, but that seems a bit
> clumsy...

> (I have an application that runs on different machines (one instance at
> each machine). The application is regularly broadcasting UDP to the
> network while running, so all the instances know about each other. The
> application establishes a socket connection to the other instances by
> calling Listen and BeginAccept, and accepting an incoming connection
> attempt, or by calling Socket.Connect(). Socket.Connect() should only be
> called if a connection with a given machine is not yet established. So,
> before calling Socket.Connect() I need to test if a connection with the
> given machine already exists. How?)

> ===================================
> This list is hosted by DevelopMentorĀ®  http://www.develop.com

> View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to