Application Example of PHP socket (fsockopen) function
Using the Fsockopen function, the first thing to do is to open the allow_url_open=on in php.ini;
Fsockopen is the encapsulation of the socket client code, which encapsulates the socket_create (), Socket_connect ().
Server-side code: server.php
"; Socket_write ($msgsock, $msg, strlen ($msg)); Returns the message to the client echo "read client message\n"; $buf = Socket_read ($msgsock, 8192); Gets the message sent by the client $
, strlen ($msg)); Return information to the client
Echo ' read client message\n ';
$buf = Socket_read ($msgsock, 8192); Get the information that the client sent over
$talkback = "2.received message: $buf \ n";
Echo $talkback;
if (false = = = Socket_write ($msgsock, $talkback, strlen ($talkback)) {//return informat
C # access modifiers Author: ay2008080808 submission date: 15:51:00 | category: | access traffic: 34
An access modifier is a keyword used to specify the accessibility of declared members or types. These keywords include public, private, protected, and internal.
1. Accessibility level (accessibility levels)
Use these access modifiers to specify the fo
clientEcho ' read client message\n ';$buf = Socket_read ($msgsock, 8192); Get the information that the client sent over$talkback = "2.received message: $buf \ n";Echo $talkback;if (false = = = Socket_write ($msgsock, $talkback, strlen ($talkback))) {//return information to the clientecho "Socket_write () failed reason
;}// Send welcome to the client$ Msg = "1. server send: welcome";Socket_write ($ msgsock, $ msg, strlen ($ msg); // return information to the clientEcho 'read client message \ n ';$ Buf = socket_read ($ msgsock, 8192); // obtain the information sent from the client.$ Talkback = "2. received message: $ buf \ n ";Echo $ talkback;If (false === socket_write ($ msgsock, $ ta
). "\ n ";
Break;
}
// Send welcome to the client
$ Msg = "1. server send: welcome
";
Socket_write ($ msgsock, $ msg, strlen ($ msg); // return information to the client
Echo 'read client message \ n ';
$ Buf = socket_read ($ msgsock, 8192); // obtain the information sent from the client.
$ Talkback = "2. received message: $ buf \ n ";
Echo $ talkback;
If (false === socket_write ($ msgsock, $
, $msg, strlen ($msg)); Return information to the client
Echo ' read client message\n ';
$buf = Socket_read ($msgsock, 8192); Get the information that the client sent over
$talkback = "2.received message: $buf \ n";
Echo $talkback;
if (false = = = Socket_write ($msgsock, $talkback, strlen ($talkback))) {//return inform
, $msg, strlen ($msg)); Return information to the client
Echo ' read client message\n ';
$buf = Socket_read ($msgsock, 8192); Get the information that the client sent over
$talkback = "2.received message: $buf \ n";
Echo $talkback;
if (false = = = Socket_write ($msgsock, $talkback, strlen ($talkback))) {//return inform
($ msg); // return information to the client
Echo 'read client message \ n ';
$ Buf = socket_read ($ msgsock, 8192); // obtain the information sent from the client.
$ Talkback = "2. received message: $ buf \ n ";
Echo $ talkback;
If (false === socket_write ($ msgsock, $ talkback, strlen ($ talkback) {// return informa
seems that the client cannot maintain a persistent connection, because "if the client receives the request, it will read the sent information and then respond, close the connection after the response"
Hope you can give me some advice on the implementation process of php socket persistent connection for multiple round-trip communication, or give a tutorial or an example.
------ Solution ----------------------
You are not in the loop. socket_close // Can you just close the connection?
------ Sol
(el.getText(),equalTo("Add note"));
4.2 How to get resource Idcan be obtained by uiautomatorviewer4.3 recommendationsIf the target device's API level is below 18, Uiautomatorviewer cannot get the corresponding resource ID, only if it is greater than 18.5. findElementByAccessibilityId5.1 example?
12
el = driver.findElementByAccessibilityId("menu_add_note_description");assertThat(el.getText(),equalTo("node"));
5.2 How to get Accessibilityidcan be obtained
information to the clientEcho 'read client message \ n ';$ Buf = socket_read ($ msgsock, 8192); // obtain the information sent from the client.$ Talkback = "2. received message: $ buf \ n ";Echo $ talkback;If (false === socket_write ($ msgsock, $ talkback, strlen ($ talkback) {// return information to the clientEcho "
Eclipse wrote an android program where Main.xml ImageView is a Huang number! Don't know why?Workaround:android:contentdescription= "@string/desc" plus this attribute is OK.Answer:What is the role of android:contentdescription?When writing an XML layout file for Android, you often encounter a hint in ImageView or ImageButton:Missing contentdescription attribute on image.What does this attribute do?In fact, this property is convenient for some of the physiological functions of the people who are d
The goal of active accessibility is to facilitate people with disabilities to use computers--for amplifiers, screen readers, and tactile mice. It can also be used to develop applications that drive other software, and in the end, its ability to simulate user input is especially appropriate for testing software development.
Starting from the basic concept of Active Accessibility, this article takes you to a
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.