Comments (5)
贴一下errCode
属性的值,看一下错误原因
from swoole-src.
<?php
use Swoole\Coroutine;
use function Swoole\Coroutine\run;
run(function () {
$socket = new Coroutine\Socket(AF_INET, SOCK_STREAM, SOL_TCP);
var_dump($socket->errCode);
$retval = $socket->connect('127.0.0.1', 9501, 1);
while ($retval)
{
$n = $socket->send('hello');
var_dump($n);
$data = $socket->recv();
var_dump($data);
//发生错误或对端关闭连接,本端也需要关闭
if ($data === '' || $data === false) {
echo "errCode: {$socket->errCode}\n";
$socket->close();
break;
}
Coroutine::sleep(1.0);
}
var_dump($retval, $socket->errCode, $socket->errMsg);
});
你要连接tcp服务端的话尝试这么写,swoole关于协程socket客户端的文档我要改一下
from swoole-src.
贴一下
errCode
属性的值,看一下错误原因
errCode是22,Invalid argument。我是网卡上配置了多IP,想循环使用不同的IP发送ICMP请求。我用php原生的socket_bind是可以成功的
from swoole-src.
目前对于 SOCKET_RAW 的支持并不完整,ICMP 的话建议直接用 php 的函数
from swoole-src.
目前对于 SOCKET_RAW 的支持并不完整,ICMP 的话建议直接用 php 的函数
👌
from swoole-src.
Related Issues (20)
- php.ini enable swoole extension composer error : segmentation fault php composer HOT 3
- postgresql在服务端主动断开连接时swoole无法捕获异常 HOT 10
- 5.1.2 Context::parse_multipart_data 导致abort 进程退出 HOT 11
- A bug occurred in Swoole-v5.1.1, please report it. HOT 19
- Websocket connection failed. SSL related Issue? HOT 1
- Swoole not supporting partitioned cookie parameter HOT 1
- Can allow_redirects be supported on the HTTP/WebSocket? HOT 7
- Alpine + Swoole + PgSQL on the host = `could not send SSL negotiation packet: Resource temporarily unavailable` HOT 16
- 已解决
- 开启一键协程化之后, `proc_open()` 似乎会受到先前空方法体的 `run(function() {});` 的影响。 HOT 1
- Worker exits without much information HOT 3
- Websocket服務,調用Task做訊息發送,出現session does not exits HOT 5
- \Swoole\Server::shutdown never gets called and signals don't seem to work with \Swoole\Process::signal() / pcntl_signal() HOT 4
- A bug occurred in Swoole-v5.1.2, please report it HOT 26
- PHP Startup Unable to load dynamic library 'swoole' HOT 2
- guzzlehttp在stream=true时,设置超时无效 HOT 5
- 协程被长时间挂起会导致内存大量增加 HOT 49
- windows swoole-cli-v4.8.13-cygwin-x64.zip 在windows上 run(function{}) 内的curl 问题 HOT 2
- 在 Swoole\Coroutine\Http\Server 中的 http server 使用 sendfile 在高并发时会导致 PHP 假死并且内存泄露 HOT 57
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swoole-src.