[.net] how to get a remote machines ipaddress from socket

Started by
1 comment, last by BradSnobar 17 years, 6 months ago
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?
Advertisement
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 space for rent.
Yep, that's what I was looking for.
Thanks.

This topic is closed to new replies.

Advertisement