T
T
Travious2016-08-11 10:44:45
PHP
Travious, 2016-08-11 10:44:45

Apache+PHP+MySQL and TCP server with LAN are running on the same server. How to combine them?

You need to make a web interface for the same local network. The web interface will be "external", with closed registration, but not the point.
The web interface will send requests to the TCP server, which will process and send something to TCP clients in the local area.
OS is Windows, not UNIX/POSIX.
I am considering the following options:
1) Do not invent anything, but simply connect PHP to a TCP server over the same TCP. That is, the Web interface will be a client of the TCP server, respectively, to communicate with it in both directions. I like this option completely, but maybe it's only at first glance? Is he good?
2) Type of distributed memory on disk. For example, in a MySQL database. Создать таблицу, web-интерфейс (php) пишет в нее, TCP-сервер читает, при необходимости и наоборот. Этот вариант мне не очень нравится по архитектуре, но MySQL кажется более "родной" средой для PHP, чем быть TCP-клиентом.
Как бы сделали вы?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2016-08-11
@Travious

Если код TCP-сервера - закрытый, я бы сделал всё на PHP, а уже через него - управлял бы TCP-сервером. Иначе - полностью все на PHP.
У PHP есть все возможности, чтобы обеспечивать сетевое взаимодействие.
Также, на внешней стороне, если будет Apache, есть mod_proxy, который позволяет перенаправлять запросы на сокеты, подключенные как папка, например: /mysocket
Apache, затем - PHP и дальше, в зависимости от открытости Вашего TCP-сервера: или mod_proxy или все реализовать на PHP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question