Please see the RemoteEndPoint Property of the Socket class. The RemoteEndPoint is set after a call to either Accept or Connect.
From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Ragnvald Barth Sent: Friday, August 12, 2005 4:48 AM To: [email protected] Subject: [ADVANCED-DOTNET] How do I get the remote IP address from a socket? 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(r) 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
