I need a script / application to save TCP connections for a PHP interface

I am making a PHP interface for a backend server using a custom protocol over TCP. Due to the rather complicated handshake when establishing connections with the server server, I would like to keep TCP connections on the server. Naturally, given the default HTTP type (and especially when using mod_php under Apache), I cannot do this directly in PHP.

I was thinking of a local "proxy server" while maintaining a server connection pool. It is important that each user of the PHP interface maintains their own connection to the server. Now this is not a very complicated program, but due to many network programming errors, I would prefer to use a reliable, mature application that could do such things.

I’m thinking something along the lines of a PHP application connecting to a proxy server, it says: “I have an ID; 123”, and from that moment all the contents to / from the server are transferred directly between the PHP interface and the server.

Any suggestions for elegant solutions for this?

Thank!

+3
source share
2 answers

Here's an idea, although it may not scale very well:

The basic idea is that you want the proxy server of these raw socket connections in some way when the connection to the backend system is saved.

, , , , (fifo), - , session_id. .

, . , PHP, (: php, nanoserv System_Deamon), , . , - , fork() .

, - , , PHP-. , -, , , session_id.

/ , , . - - ( - /, ), .

0

Source: https://habr.com/ru/post/1765156/


All Articles