i have a simple socket server program that i need to get the client's machine name that just connected. i know i could get it off the client, and then pass it to the server, but is there a way to have the socket get the name of the machine?
i'm using c# and not asp. thanks

1 answers
your server socket will give you the remote endpoint of the client socket. From there you have to have access to a domain name server that has the ip address you get in the client connection to some computer name.
this assumes that people's machine name are even mapped in some externally available dns server.
this also assumes that nobody ever uses a proxy. if they do you'll get the ip address of the proxy not the orig. computer.
the short answer is, you're not going to reliably get that information. If you want it, send it from the client.
the long answer is, if you really want it, and clients are willing and able to comply then you can by using the Dns.GetHostEntry passing in the remote endpoint ip address.
good luck.
answered one year ago by:
2309