Home  >  Article  >  Backend Development  >  How to obtain unclosed socket resources in php? ?

How to obtain unclosed socket resources in php? ?

WBOY
WBOYOriginal
2016-09-21 14:12:53835browse

After creating $socket = socket_create -> socket_bind -> socket_listen, the $socket resource is not closed.

When I reopen this page, how can I use the $socket resource created last time? ?

Reply content:

After creating $socket = socket_create -> socket_bind -> socket_listen, the $socket resource is not closed.

When I reopen this page, how can I use the $socket resource created last time? ?

If you are in an fpm environment, then I can tell you that it is impossible. This kind of resource will be released uniformly after the end of a request.
If you want to maintain a persistent connection in php, you need to have a cli Start long-running environment

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn