Describes in detail the case of php code for compiling TCP server and client programs

Source: Internet
Author: User
1. modify php. ini, open extensionphp_sockets.dll2, and the server program SocketServer. php & lt ;? Php ensures that set_time_limit (0) will not time out when connecting to the client; set the IP address and port number $ address127.0.0.1; $ port3046; *** create a SOCKET * AF_INET 1. modify php. ini, open extension = php_sockets.dll

2. server program SocketServer. php

 

3. client program SocketClient. php

 


4. test

Run the server program C: \ wamp \ bin \ php \ php5.4.16 \ php.exe C: \ wamp \ www \ SocketServer. php

Run the client program C: \ wamp \ bin \ php \ php5.4.16 \ php.exe C: \ wamp \ www \ SocketClient. php

5. The process is similar to that of C. in fact, it encapsulates the socket of C.

The above section details the code cases for compiling TCP server and client programs in php. For more information, see other related articles in the first PHP community!

Related Article

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.