Sign in to follow this  

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

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this