maxfolder/unix_socket
Composer 安装命令:
composer require maxfolder/unix_socket
包简介
unix socket
README 文档
README
Unix socket server with multiple clients
Install
-
composer require maxfolder/unix_socket
-
set path to your local socket file in socket.ini example: /var/www/server.socket
Getting Started
create server.php
if (file_exists($settings['SOCK_FILE_PATH'])) {
unlink($settings['SOCK_FILE_PATH']);
}
$server = (new ServerSocketDataBuilder())
->setDomainServerSocketFilePath($settings['SOCK_FILE_PATH'])
->setProtocolFamilyForSocket(AF_UNIX)
->setTypeOfDataExchange(SOCK_STREAM)
->setProtocol(0)
->setMaxByteForRead(65536)
->built();
$server->run();
create client.php
$client = (new ClientSocketDataBuilder())
->setDomainServerSocketFilePath($settings['SOCK_FILE_PATH'])
->setProtocolFamilyForSocket(AF_UNIX)
->setTypeOfDataExchange(SOCK_STREAM)
->setProtocol(0)
->setMaxByteForRead(65536)
->built();
$client->run();
run server.php in console then client.php in another console
License
This project is licensed under the MIT License - see the LICENSE.md file for details
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-23