note 80397 added to ref.sockets

From: Date: Mon, 14 Jan 2008 11:02:31 +0000
Subject: note 80397 added to ref.sockets
Groups: php.notes 
Request: Send a blank email to php-notes+get-135084@lists.php.net to get a copy of this message
NOTE! If you are trying to send a broadcast-message using this code you _may_ get a "Permission denied"-Error at socket_connect, even if you are running this as root on a linux box. <?php $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); socket_connect($sock,"255.255.255.255", 10000); socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, 1); $buf = "Hello World!"; socket_write($sock,$buf,strlen($buf)); socket_close($sock); ?> The only workaround for this is to get the broadcast address of the interface and walk through all IPs with a for-loop. ---- Server IP: 212.124.37.9 Probable Submitter: 84.184.109.21 ---- Manual Page -- http://www.php.net/manual/en/ref.sockets.php Edit -- https://master.php.net/note/edit/80397 Del: integrated -- https://master.php.net/note/delete/80397/integrated Del: useless -- https://master.php.net/note/delete/80397/useless Del: bad code -- https://master.php.net/note/delete/80397/bad+code Del: spam -- https://master.php.net/note/delete/80397/spam Del: non-english -- https://master.php.net/note/delete/80397/non-english Del: in docs -- https://master.php.net/note/delete/80397/in+docs Del: other reasons-- https://master.php.net/note/delete/80397 Reject -- https://master.php.net/note/reject/80397 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135084) next »