httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djwiktor <>
Subject [users@httpd] Socket_bind - cannot read from socket. why?
Date Sun, 14 Sep 2008 18:13:30 GMT

I have a problem with a simple (allegedly) function to read socket data and
save it in a file.
The code look as follows:

// Set the ip and port we will listen on 
$host = ''; 
$port = 20000; 


// create low level socket
    trigger_error('Error creating new socket',E_USER_ERROR);

# reuse socket tweak
  if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
    echo socket_strerror(socket_last_error($socket));

// tie up socket to TCP port
    trigger_error('Error binding socket to TCP host:'.$host.',

// begin listening connections
    trigger_error('Error listening socket connections',E_USER_ERROR);

// create communication socket
    trigger_error('Error creating communication socket',E_USER_ERROR);

// read socket input

//write data to file

// close sockets


However, right away after the script is launched I get an error message

PHP Warning:  set_time_limit(): Cannot set time limit 
PHP Warning:  socket_bind() unable to bind address [98]: Address already in
Could not bind to address

This problem occurrs regardless of port number and if it is declared in
httpd.conf or not.
No matter which server port I use it always seems 'busy'.

Please give me a hint what is the cause of the problem.


View this message in context:
Sent from the Apache HTTP Server - Users mailing list archive at

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message