php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32363 socket_bind can't bind
Submitted: 2005-03-18 17:36 UTC Modified: 2005-03-18 19:11 UTC
From: motion_4u at hotmail dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.0.3 OS: Apache 2 on win2k
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: motion_4u at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-03-18 17:36 UTC] motion_4u at hotmail dot com
Description:
------------
socket_bind() function on Apache2/ Win2k can't bind

Reproduce code:
---------------
$dest="127.0.0.1";
$port=80;
//"daemon" in UDP
$socketD = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); 

if($socketD === FALSE) { // something went wrong
       echo 'socket_create failed: '.socket_strerror(socket_last_error())."\n";
       exit(1);
   } 
   /*
   This is the second option but still doesn't work
   if(!socket_bind($socketD, "0.0.0.0", 27123)) 
   */
   if(!socket_bind ($socketD, 0, $port))
   {
   socket_close($socketD);
   echo 'socket_bind failed: '.socket_strerror(socket_last_error())."\n";
    exit(1);
   }

Expected result:
----------------
This is the PHP error message:
Warning: socket_bind() [function.socket-bind]: unable to bind address [0];

I realy dug into the documentations and examples and find it hard to believe that I do something wrong. The warning message explains that the socket it already binded and cannot be used twice :((


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-18 19:11 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 20:01:29 2024 UTC