Client IP Address
Client IP Address
Hi
I am using VB.net to run a Server Client application through TCP/IP I managed to connect and transmit data. One probel I am finding is that I need to get the IP address of the client while accepting and compare it to a list in the database. If the IP address is not in the database, the connection will be terminated.
Can someone pls show me how to red the Client's IP address.
Thank you all

Client IP Address
Dukeboss
hi,
i'm searching for the same thing and i found this in other thread
http://www.developerfusion.co.uk/show/3918/
best regards
Wurschti
Once you accept the TCPClient
use
TcpClient.Client.RemoteEndPoint.Address
if you are using Sockets use Socket.RemoteEndPoint.Address
pavlo_ua
Hi,
With .NET's socket class I think a standard way to "filter" connections would be to initially accept all incoming connections by calling the .Accept() method on the listening socket, and then to close any of the resulting sockets where the IP Address as found it that socket's RemoteEndPoint isn't in your list. e.g.:
> Dim connection as Socket=listeningSocket.Accept()
>
> If AddressInDatabase( _
> CType(connection.RemoteEndPoint, IPEndPoint).Address) Then
> HandleNewConnection(connection)
> else
> connection.Close()
> End If
Note that the Address property returns an object of type System.Net.IPAddress, not a string.
SVK
Thank You
Nick Poulis
aldone
Lets us know what you tried and what did not work.
For TCP/IP using .NET.
http://search.msn.com/results.aspx q=TCP%2FIP+C%23+tutorial&FORM=QBHP