ZMQ CANNOT BIND, ADDRESS ALREADY IN USE

6,009 views
Skip to first unread message

Winnie Nakimuli

unread,
May 6, 2013, 4:57:58 AM5/6/13
to ratch...@googlegroups.com
hallo,thank you so much for the continous support you offer to us, and the patience
Now am trying to run a simple application using ratchet and ZMQ after following the push tutorial but this is the error am getting

 'ZMQSocketException' with message 'Failed to bind the ZMQ: Address already in use' in /opt/lampp/htdocs/vendor/react/zmq/src/React/ZMQ/SocketWrapper.php:114,and when i change the port number, from 5555 to something else the error is nolonger there though now i get another error, 
 Uncaught exception 'React\Socket\ConnectionException' with message 'Could not bind to tcp://0.0.0.0:8080: Address already in use'

and when i run netstat -ap | grep tcp, it's only php listening on port 5555, so do i kill this process first before binding not sure of what to do???

Igor Wiedler

unread,
May 6, 2013, 9:08:26 AM5/6/13
to ratch...@googlegroups.com
Hi,

You can't have multiple scripts binding to the same port at the same time. Either change the port numbers of the second script or kill the first script before you run the second.

Regards,

Igor
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Ratchet" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ratchet-php...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Winnie Nakimuli

unread,
May 7, 2013, 5:39:11 AM5/7/13
to ratch...@googlegroups.com
Hi, thank you for your response.Am trying to use the post method to capture some information from the client and the post script is supposed to be connecting to the push-server script to be able to push the result to all connected clients , but it gives the error above.
Not sure what the problem is, because to kill the process i will be killing the php script that is running the server
my post script is given below

header('Access-Control-Allow-Origin: *');

require ("/opt/lampp/htdocs/bin/push-server.php");

 $min = $_POST['min'];
 $max = $_POST['max'];
  
 $entryData= mt_rand( $min,$max);
    
 $loop = React\EventLoop\Factory::create();

    $context = new React\ZMQ\Context($loop);

    $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');

    $socket->connect("tcp://localhost:5555");

   $socket->send(json_encode($entryData));

Thank you


You received this message because you are subscribed to a topic in the Google Groups "Ratchet" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ratchet-php/4KmFiNhQYkI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ratchet-php...@googlegroups.com.

Winnie Nakimuli

unread,
May 9, 2013, 3:55:00 AM5/9/13
to ratch...@googlegroups.com

Thank you so much for the continuous support, i noticed my mistake that was in the require ("/opt/lampp/htdocs/bin/push-server.php"); so now everything is fine.


Thank you so much for this great library it has so helpful in my Class project, despite me being new at programming i was able to follow through with a few challenges here and there but at the end it works like a charm.

So, thank you am definitely spreading the news.



Reply all
Reply to author
Forward
0 new messages