Jump to content
  • Advertisement
Sign in to follow this  
BradSnobar

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

This topic is 4401 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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!