我需要在PHP中建立一个持久套接字连接,但不确定如何实现这一点。目前,当我发送SMS消息时,我a)打开一个套接字连接b)发送消息(通过SMS/SMPP)和c)关闭套接字连接用于SMPP/SMS的持久套接字/连接PHP
但是我不需要一直打开和关闭连接。相反,我需要
- 2 persistent connections that maintains connectivity to an SMSC (SMS centre) and reconnects when a timeout occurs.
- One persistent connection for reading SMS and one for sending SMS.
- Automatic restart/recovery (i.e. when memory issues arise)
- Automatic looping to act as listener for incoming events such as receiving incoming delivery receipts and sms messages, as well as 'ping' (enquire link) to keep SMPP connection alive.
更新:不知道是否有人曾使用以下实现以上:https://github.com/shaneharter/PHP-Daemon
http://php.net/manual/en/function.shm-put-var.php这里有一个很好的阅读关于评论。 – sinni800 2013-03-06 09:51:59
我有这个需求在这个项目中完成:https://github.com/nimf/phpesme/我们有一种看门狗脚本,它确保rx,tx和处理程序进程始终运行,并将在退出时重新启动。 – 2013-03-27 07:35:25
谢谢尤里。几周前,我会认真考虑诸如您提供链接的解决方案。然而,最近几周我已将所有PHP/SMPP升级到Java/SMPP,并没有回头看看:-) – user1746582 2013-03-27 15:49:11