On 2003-11-05, Sebho <no**********@ifrance.com> wrote:
Hello,
i made an app that use sockets, based on this sample :
http://www.microsoft.com/downloads/d...displaylang=en
i'have a problem, i can't obtain the client IP adress on the server side (i
have a pointer to a TCPclient object)
Is averyone that know how to retrieve the IPadress from a TCPclient Object ?
Thanks for your help
Sebho
Unfortunately, the TcpClient class does not directly expose a method to
do this. The only way it can be done, is to create your own class that
inherits from TcpClient - that way you can access the protected Client
property. It would look something like:
Public Class MyTcpClient
Inherits TcpClient
' Add your contructors
....
' Add your client Ip property
Public ReadOnly Property ClientIP() As IPAddress
Get
Return CType(Me.Client.RemoteEndPoint, IPEndPoint).Address
End Get
End Property
End Class
Anyway, it's a little bit of air code :)
HTH
--
Tom Shelton
MVP [Visual Basic]