1,105,594 Community Members

Get client ip address

Member Avatar
kubiak
Newbie Poster
18 posts since Jan 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, i have csharp server(console application) and java client. I need to get a java client ipaddress, can someone tell me what is the function in csharp? I am new in csharp. I was searching on web and nothing help me.

Member Avatar
tinstaafl
Postaholic
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 402 [?]
Skill Endorsements: 35 [?]
 
0
 

you could always call netstat. that'll give you the ip of every machine connected to yours, and also the stat of that connection.

Member Avatar
darkagn
Veteran Poster
1,199 posts since Aug 2007
Reputation Points: 279 [?]
Q&As Helped to Solve: 216 [?]
Skill Endorsements: 21 [?]
 
0
 

You can obtain the client IP address with the following call:

string clientConnection = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address.ToString();

where tcpClient is your TCPClient object.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: