C#C
C#3y ago
zylog

❔ How to get IP address of the Client whom is trying to connect to my server?

hey,
as a C# server, how do I get the client's public Ip Address ?
on python we used to just get the
request
object and look at
ip_address
property on it, not sure how to do that in c# and the alternative ways I saw how was pretty dum in my opinion ,it goes like this
string ipAdd =  webClient.DownloadString("https://api.ipify.org/");

then they trim and replace the string to just get ip address without any extra symples.
there must be a way for C# as a server to know the IP of comming connections rather than that mess I've mentioned above ... requests come from a public Ip address
Was this page helpful?