How php actively sends messages to the terminal-php Tutorial

Source: Internet
Author: User
How php actively sends messages to the terminal now has such an application scenario, there is a php background information publishing system control terminal, used to control the outdoor information publishing Terminal (advertising machine, outdoor Display, etc.), when the customer clicks restart on the browser page, switches off the machine or performs other operations, how can I send this information to the terminal?
I have read some push methods, or the cloud is in the fog. many of them need to be sent by the terminal first. can someone tell me?


Reply to discussion (solution)

What is a terminal? your requirements are a little abnormal. it should not be something php can do. it should already be in the scope of software development.

On the browser page, the customer clicks restart, switches the host, or performs other operations. how can I send this information to the terminal?
This depends on the display type. if you can use SOCKET to connect, use SOCKET to connect.

Terminals are advertising machines and external screens.
If http cannot be used, you can use socket. in php, you can use socket to actively send information. how can this problem be solved?


On the browser page, the customer clicks restart, switches the host, or performs other operations. how can I send this information to the terminal?
This depends on the display type. if you can use SOCKET to connect, use SOCKET to connect.

The B/S model is obviously insufficient.
First, there must be a very small number of people who have the permission to publish information. Secondly, since they are all controlled through the network, it is not enough to directly create a client with the authorization function to send information directly to the terminal to be controlled? There is no need for web pages, which is quick and easy. Do not use PHP for the purpose of using PHP. such usage will never improve. Instead, you may be confused by your poor demand.

Terminals are advertising machines and external screens.
If http cannot be used, you can use socket. in php, you can use socket to actively send information. how can this problem be solved?


Reference the reply from zhouzhipen on the second floor:

On the browser page, the customer clicks restart, switches the host, or performs other operations. how can I send this information to the terminal?
This depends on the display type. if you can use SOCKET to connect, use SOCKET to connect.



Yes, it depends on how your "advertising machine, external screen" contacts your php server.

Php has a socket library, but there are many other methods, not necessarily required

Know how to use php for socket.

Thank you for your reply. we already have c/s and I will not be confused about the requirements yet. on the 4th floor, we may have a lack of understanding about our things. some of the things you are certain about are not exactly the same.

The B/S model is obviously insufficient.
First, there must be a very small number of people who have the permission to publish information. Secondly, since they are all controlled through the network, it is not enough to directly create a client with the authorization function to send information directly to the terminal to be controlled? There is no need for web pages, which is quick and easy. Do not use PHP for the purpose of using PHP. such usage will never improve. Instead, you may be confused by your poor demand.

The key to the problem is that this project only has half-tone php...

Do you have any suggestions on the 7th floor?

The key to the problem is that this project only has half-tone php...

The terminal was previously contacted by the server through http. the previous method was as follows: when an operation occurred on the page, we stored the operation command in a file, the terminal regularly retrieves this file through http. Now consider whether the server can actively push these Operation commands to the terminal.
What do other methods on the fifth floor mean? Can you give me some advice?


Reference the reply from challchampion on the third floor:

Terminals are advertising machines and external screens.
If http cannot be used, you can use socket. in php, you can use socket to actively send information. how can this problem be solved?


Reference the reply from zhouzhipen on the second floor:

On the browser page, the customer clicks restart, switches the host, or performs other operations. how can I send this information to the terminal?
This depends on your display type. if you can use SOC ......

I will certainly not use php if I want to use it. if I want to use php, I can use it as a front-end and write another server to receive php input data for control. Or directly develop the server and client, and leave php behind.

Maybe php is fixed. you can also set up php on both the front end and your backend (on the advertising machine) to transmit data. the advertising machine is actually a win operating system. it's much easier to directly post get and process it... process the event into a bat file to call it...


Do you have any suggestions on the 7th floor?

Reference phpnewnew on the 7th floor:

The key to the problem is that this project only has half-tone php...

First, determine how your terminal communicates with the server.

Regular ajax rows?

Now all the products such as advertising machines are embedded architectures with limited resources. In addition, the B/s control end needs to be connected with the advertising machines of other companies, therefore, I can only discuss with each other in the agreement at most.
What does php mean by directly developing servers and clients?


I will certainly not use php if I want to use it. if I want to use php, I can use it as a front-end and write another server to receive php input data for control. Or directly develop the server and client, and leave php behind.

Maybe php is fixed. you can also set up php on both the front end and your backend (on the advertising machine) to transmit data. the advertising machine is actually a win operating system. it's much easier to directly post get and process it... process the event into a bat file to call it...


Reference 8 ......

The previous method was mentioned on the 9th floor. I hope this method can be improved.
I just learned that the server push basically requires a persistent connection between the client and the server, which may not work. do you know this.
For other methods, tcp or udp can also be considered.

First, determine how your terminal communicates with the server.

My terminal is a linux system (advertising machine) without a browser. the idea of timed ajax is just like our previous method. I hope there is a way to improve it. at present, I hope the server can actively push it.

Regular ajax rows?

What does php mean by directly developing servers and clients?

I am talking about your cs.

Let the other party release such an interface. the customer must have your requirements. This should not allow you to solve the problem and require them to provide interfaces.

We also have our own advertising Machines. if we interact with ourselves, which method would you consider appropriate?

What does php mean by directly developing servers and clients?

I am talking about your cs.

Let the other party release such an interface. the customer must have your requirements. This should not allow you to solve the problem and require them to provide interfaces.

We are not very clear about your system.

I am not very clear about what an advertisement machine is, or a software running on linux?

This is how the advertisement machine (A) communicates with the php Server (B.

Of course, you can also use the current method. In fact, the advertising machine probably does not have to respond in real time. if the current method runs normally, there is no need to change it.

Communication between A and B generally involves one server and one client. your current method is server B, and server A serves as the client.

If you want to "push", it requires long connections or special support from servers. Currently, it is not common. ajax polling is actually similar to your current solution, and it is not applicable because A is neither A browser.

Let's just put it all in one loop,

Since it is linux, A can be used as the server. The daemon process X is run on the server. B receives A command from php and sends A request to X on A through socket, then, run the corresponding command on X. of course, it is better to use c/c ++ and the like.

No socket is required. any method that can exchange information between A and B can... for example, if ssh runs commands in the past and ftp uses A text file, X directly connects to the database on A to obtain information... of course, this includes your existing solutions ....

Thanks for your analysis. the advertisement machine can be considered as a software running on linux.
The reason why I want to change the solution is that the previous response is too slow. for example, if I want to set the volume of the ad machine or obtain the volume of the ad machine, the response speed is very slow and the user experience is not very good. Now we need to re-develop this system, which requires a large number of advertising machines and operators to be supported. Therefore, we need to consider whether there is a better solution.


We are not very clear about your system.

I am not very clear about what an advertisement machine is, or a software running on linux?

This is how the advertisement machine (A) communicates with the php Server (B.

Of course, you can also use the current method. In fact, the advertising machine probably does not have to respond in real time. if the current method runs normally, there is no need to change it.

Communication between A and B generally involves one server and one client. your current method is server B, and server A serves as the client.

If ......

One mechanism is that the client requests data from the server at regular intervals! One request per day, the server changes, and the second takes effect!

The other is the port or service that the client must receive external information. In this way, the peer can receive and decrypt the socket information. Or the client has web services.

The first method is the current method. The time is too long and the real-time performance is not enough. The time is too short and the server pressure is too high.
Second, because our advertising machines are all behind the vro, how can we establish a socket?
How does a chat tool like qq work?

One mechanism is that the client requests data from the server at regular intervals! One request per day, the server changes, and the second takes effect!

The other is the port or service that the client must receive external information. In this way, the peer can receive and decrypt the socket information. Or the client has web services.

Generally, AJAX is used to regularly retrieve data from the server.

There is a way to identify
The B/S client uses a hidden flash. after the user's operation, the js obtains the operation and notifies flash. then, the flash receives the notification and establishes socket communication with the php Server. after php finishes processing the message, send the information to flash and close the socket communication. flash sends the content returned by php to js, and js updates the page content...
I don't know how this idea works. please identify it ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.