You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a TCP application; I expect to create TCP sockets in the master process and complete bind and listen; Accept in the fork child process;
Can this library support passing raw socket to the constructor:
If you create a socket file descriptor and then fork the process, both the parent and child process will have access to the same socket file descriptor and can accept connections from it. This means you don't have to "create a new server" in the child process, the whole process space will be copied to the child process. That being said, forking in PHP is anything but trivial and it's way too easy to leak resources, so I wouldn't recommend doing this unless you're sure you know what you're doing.
On top of this, we're also working on a solution to create a socket server instance from an existing file descriptor number (i.e. a socket file descriptor inherited from the the parent process). This is being discussed in #164 which also includes a prototype implementation for you to give a try.
I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this 👍
Hello!
I'm trying to write a TCP application; I expect to create TCP sockets in the master process and complete bind and listen; Accept in the fork child process;
Can this library support passing raw
socket
to the constructor:The text was updated successfully, but these errors were encountered: