note 29445 rejected from function.socket-bind by arash
| From: | arash@php.net | Date: | Thu, 26 May 2011 19:00:30 +0000 |
| Subject: | note 29445 rejected from function.socket-bind by arash | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180062@lists.php.net to get a copy of this message | ||
Note Submitter: masuod_a at hotmail dot com
----
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);
?>