List Info

Thread: note 78475 added to function.socket-getsockname




note 78475 added to function.socket-getsockname
user name
2007-10-13 14:35:30
Just a quick note:
I found socket_getsockname() is not IPv6 compatible or may
just return some unexpected results?

<?php
Simple Code Example:

$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
	socket_bind($socket,'0.0.0.0',150);

socket_getsockname($socket, $IP, $PORT);

print $IP.":".$PORT."n";

?>

This does not print $IP 127.0.0.1 or 192.168.1.1 or even
0.0.0.0 ... etc ... like you would expect ... in my case I
receive 10.0.0.0 witch is not a valid port on my system
using IPv5 and IPv6! Thus you should rely on using the
initial values of socket_bind() to get the local address. 

Hope this helps...
----
Server IP: 69.147.83.197
Probable Submitter: 99.229.144.127
----
Manual Page -- http://www.php.net/manual/en/function.socket-getsock
name.php
Edit        -- https://master
.php.net/note/edit/78475
Del: integrated  -- h
ttps://master.php.net/note/delete/78475/integrated
Del: useless     -- http
s://master.php.net/note/delete/78475/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78475/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78475/spam
Del: non-english -- 
https://master.php.net/note/delete/78475/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78475/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78475
Reject      -- https://mast
er.php.net/note/reject/78475
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )