...

View Full Version : socket view problem



zodehala
01-18-2012, 07:46 AM
$socket = $_SERVER["REMOTE_ADDR"].":".$_SERVER['REMOTE_PORT'];
echo $socket;


result is ::1:49780

where is the problem

Fou-Lu
01-18-2012, 02:42 PM
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.

zodehala
01-21-2012, 09:53 AM
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 ?

Fou-Lu
01-21-2012, 05:44 PM
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.

zodehala
01-21-2012, 08:41 PM
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 http://support.knology.net/images/cmd2.gif

but know why ipv6 form ?

Fou-Lu
01-22-2012, 04:06 AM
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.

zodehala
01-25-2012, 10:59 AM
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

http://www.divran.com/s/upload/images/fe7nue04g6cp2kpqob7y.jpg

tangoforce
01-25-2012, 12:46 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum