Advertisement Jump to content
Sign in to follow this  
BradSnobar

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

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!