note 29445 modified in function.socket-bind by aidan
| From: | aidan@php.net | Date: | Thu, 24 Feb 2005 07:19:55 +0000 |
| Subject: | note 29445 modified in function.socket-bind by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85465@lists.php.net to get a copy of this message | ||
if you want to connect to server by specified port and you don't know your ip address or you
have multiple interface for connecting to network , you can bind null instead of valid ip address
like this :
<?php
$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$local_port=1023;
socket_bind($socket,null,$local_port);
socket_connect($socket,$remote_host,$remote_port);
?>
--was--
if you want to connect to server by specified port and you don't know your ip address or you
have multiple interface for connecting to network , you can bind null instead of valid ip address
like this :
$socket=socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$local_port=1023;
socket_bind($socket,null,$local_port);
socket_connect($socket,$remote_host,$remote_port);
http://php.net/manual/en/function.socket-bind.php