Re: IP Address's

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: R2D2 (R2D2_at_discussions.microsoft.com)
Date: 12/18/04


Date: Sat, 18 Dec 2004 11:21:01 -0800

I am using the AcceptTcpClient, how would I go about creating a derived class
to access the property?

"Dmitriy Lapshin [C# / .NET MVP]" wrote:

> Hi,
>
> It depends on how you accept incoming TCP connections in the TcpListener. If
> you use AcceptSocket, it will return you a Socket instance which you can
> query for RemoteEndPoint property.
> If you however use AcceptTcpClient, you will have to create a derived class
> to access the protected TcpClient's Socket property.
>
> --
> Sincerely,
> Dmitriy Lapshin [C# / .NET MVP]
> Bring the power of unit testing to the VS .NET IDE today!
> http://www.x-unity.net/teststudio.aspx
>
> "R2D2" <R2D2@discussions.microsoft.com> wrote in message
> news:4D5C925A-CF01-4BAD-B7FC-CB441D0D64F9@microsoft.com...
> > Is there any way to resolve the ip address of the host machine or a
> > machine
> > at the other end of a network connection? I have created a client-server
> > Tcp
> > project that only uses the TcpClient and TcpListener classes for the
> > connections.
> > I have tried:
> > Dns.Resolve("localhost").Address[0].ToString();
> > but that only gives me "127.0.0.1"
> > I would prefer it though if I could resolve the address of the clients
> > from
> > the server, rather than having to pass the IpAddress across the network.
> > Any ideas?
> > Thanks
>
>