Home>Article>Backend Development> Detailed explanation of socket-to-server communication examples in PHP

Detailed explanation of socket-to-server communication examples in PHP

墨辰丷
墨辰丷 Original
2018-05-26 15:26:09 1207browse

This article mainly introduces a detailed example of client-to-server communication using PHP sockets. It has certain reference value and interested friends can refer to it.

1. server.php server:

##

2. client.php client:

These two pieces of code are a brief introduction to implementation using PHP Communication between the client and the server


For specific operations, use the PHP command to open the SERVER under DOS and put it in the listening state..


Open a DOS window again and use the PHP command Open CLIENT, and you will get a response from the server....


The above is the entire content of this article, I hope it will be helpful to everyone's learning.


Related recommendations:

How to operate nodejs using websocket

Native nodejs uses websocketCode sharing

PHP uses Socket to obtain the SSL certificate and public key of the website

The above is the detailed content of Detailed explanation of socket-to-server communication examples in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn