[.net] how to get a remote machines ipaddress from socket
Hello,
I want to be able to figure out what the ipaddress or hostname of a machine that has connected to my server is.
The trick here is that I want to do so without just having the connecting machine send me the data directly. There must be able to figure that information out just with the connection.
Here is what I can start with...
TcpListener srv = new TcpListener(25);
srv.Start();
Socket sock = srv.AcceptSocket();
System.Console.WriteLine("Accepted Connection from.... ?");
Any ideas?
you can use Socket.RemoteEndPoint.ToString(), but i'm not sure if this would be a proper or preferred method. i still haven't used c# much.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement