Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    socket view problem

    Code:
    $socket = $_SERVER["REMOTE_ADDR"].":".$_SERVER['REMOTE_PORT'];
    echo $socket;
    result is ::1:49780

    where is the problem

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    There's no problem with this. ::1 is a valid IPv6 address and 49780 is simply the port in use. Try it in a test location on your remote server instead of on your local machine to see what it does; you should (likely I should say) get an IPv4 address instead.

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    There's no problem with this. ::1 is a valid IPv6 address and 49780 is simply the port in use. Try it in a test location on your remote server instead of on your local machine to see what it does; you should (likely I should say) get an IPv4 address instead.
    how can i pirnt my local computer ipv4 ?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by zodehala View Post
    how can i pirnt my local computer ipv4 ?
    Local from what perspective, the server or the client? Client is typically under $_SERVER['REMOTE_ADDR'] and server under $_SERVER['SERVER_ADDR']. If you are running on a localhost, both will likely be either 127.0.0.1 or ::1 when you access from that machine.

  • #5
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Local from what perspective, the server or the client? Client is typically under $_SERVER['REMOTE_ADDR'] and server under $_SERVER['SERVER_ADDR']. If you are running on a localhost, both will likely be either 127.0.0.1 or ::1 when you access from that machine.
    in xp i can see my host ip like in picture

    but know why ipv6 form ?

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    As long as you are testing locally, you will always have a hard time pulling IP information from yourself. This is because the hosts is essentially looping the request back to your machine directly, so it does not go out via connections to the ip address for the server. Therefore, it sees this as being local (127.0.0.1 or ::1, although I'm not sure how you got this as ipv6 does not appear enabled on your machine). 192.168/16 is a private network address, and doesn't reflect your real address. Although you can retrieve a 192.168 level address by typing in 192.168.0.14/yourscript.php and it should relay both the remote addr and server addr as that 192.168/16 address.

    I'm not sure at what point its resolving the ipv6 at all. From the looks of this, you do not have ipv6 configured.

  • #7
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    As long as you are testing locally, you will always have a hard time pulling IP information from yourself. This is because the hosts is essentially looping the request back to your machine directly, so it does not go out via connections to the ip address for the server. Therefore, it sees this as being local (127.0.0.1 or ::1, although I'm not sure how you got this as ipv6 does not appear enabled on your machine). 192.168/16 is a private network address, and doesn't reflect your real address. Although you can retrieve a 192.168 level address by typing in 192.168.0.14/yourscript.php and it should relay both the remote addr and server addr as that 192.168/16 address.

    I'm not sure at what point its resolving the ipv6 at all. From the looks of this, you do not have ipv6 configured.
    my conf is for ipv4


  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    No, it isn't.

    Your conf is IPv4 AND IPv6.

    You have both in that list and that is where your IPv6 address is being detected.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •