1

I have a wcf service running on LAN server, use tcp/ip mode. Now I need to get every client info when the client send request connect the wcf service. Because it's all on LAN. I just need get the client MAC, IP , PC name. Is there any way to get these info ? thanks.

qakmak
  • 1,287
  • 9
  • 31
  • 62
  • See [duplicate](http://stackoverflow.com/questions/93162/obtaining-client-ip-address-in-wcf-3-0) to find the IP. Getting a MAC and hostname from an IP are two separate questions, search and you will find. – CodeCaster Jul 08 '14 at 09:28

2 Answers2

0

You could try something like this:

var properties = OperationContext.Current.IncomingMessageProperties;
var endpointProperty = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
if (endpointProperty != null)
{
    var ip = endpointProperty.Address;
}

For more information about OperationContext class, please have a look here.

Christos
  • 53,228
  • 8
  • 76
  • 108
-3

http://msdn.microsoft.com/en-us/library/system.environment.machinename(v=vs.110).aspx for computer name

Get public/external IP address? for ip address

Reliable method to get machine's MAC address in C# for MAC

Please consider googleing before posting a question, I found these answers in 2 minutes.

Community
  • 1
  • 1
Alex Barac
  • 632
  • 4
  • 12
  • You foolish guy, Please read the question carefully before googling. Somebody requires client details, not server details. – Maitrey684 Nov 29 '16 at 06:26