Question What I can to do for get the client's public IP address?

NETANEL.S

Member
Joined
Feb 14, 2019
Messages
21
Programming Experience
3-5
I tried to get IP via
C#:
Request.ServerVariables["REMOTE_ADDR"]
but without success
 
And where EXACTLY did you use that code? How exactly did you use it? What happened when you used it? This seems to be a continuation of another thread but there's no indication that you have addressed that other issue. Please provide a full and clear explanation of the problem. One line of code and "it doesn't work" are not adequate.
 
Last edited:
And where EXACTLY did you use that code? How exactly did you use it? What happened when you used it? This seems to be a continuation of another thread but there's no indication that you have addressed that other issue. Please provide a full and clear explanation of the problem. One line of code and "it doesn't work" are not adequate.
I'm looking for a way to get a client IP address that connects to a server using TCP
Do you have ideas?
it's URGENT
 
You can use below code
JavaScript:
  <script type="text/javascript">
    var getIPAddress = function() {
      $.getJSON("https://jsonip.com?callback=?", function(data) {
        alert("Your IP address is :- " + data.ip);
      });
    };
  </script>
 
So are you saying, without actually saying, that you are using a TcpListener and calling AcceptTcpClient or the like? We should not have to drag this information out of you bit by bit. When I said that you should provide a FULL and CLEAR explanation of the problem, that's what I meant. We can't help you if we don't have all the relevant information. You say it's urgent but you're the one holding up the process by not helping us to help you. Stop trying to post as few words as possible and explain to us what you're trying to achieve, how you're trying to achieve it and what happens when you try. For instance, the ServerVariables property is a member of the HttpRequest class (and a couple of others) so you would generally use it in a Web Forms page or the like, where you already have in inbuilt Request property. It seems like that does not describe your situation but you didn't bother to tell us either way, so we can only guess. Take the time to provide ALL the relevant information and you'll probably get a solution straight away.
 
Back
Top Bottom