Phpsocket read data display problem now the buffer obtained after connecting to the socket with php can be printed, the page shows as follows: received data is as follows: response & nbsp; was: 1 & nbsp; response & nbsp; was: 1 & nbsp; res php socket read data display problem
The buffer obtained after connecting to the socket with php can be printed. The following figure shows the display on the webpage:
The received data is as follows:
Response was: 1
Response was: 1
Response was: 1
Response was: 1
Response was: 1
Response was: 1
Response was: 1
I want to enter this buffer in a text box and refresh it all the time. I don't know how to implement it. please help me. Below is my code!
If (isset ($ _ POST ['click']) {
Echo "the received data is as follows :";
Echo"
";
$ Port = $ _ POST ["t2"];
$ Host = $ _ POST ["t1"];
Set_time_limit (0 );
$ Socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP) or die ("cocould not create socket \ n"); // create a Socket
$ Connection = socket_connect ($ socket, $ host, $ port) or die ("cocould not connet server \ n"); // connection
// $ Connection = socket_connect ($ socket, "127.0.0.1", 7777) or die ("cocould not connet server \ n"); // Connect
Socket_write ($ socket, "hello socket") or die ("Write failed \ n"); // send a message to the server
Ob_end_flush ();
// Echo str_pad ("", 256 );
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