如何和swf文件通信

continue

workman如何和swf文件通信 :

这里-----$connection_to_access->send("GET /ISSNew_e.swf---

$task = new Worker();
// 心跳间隔25秒
define('HEARTBEAT_TIME', 20);

$GLOBALS = 'www.i-access.com';
// 进程启动时异步建立一个到host连接对象,并发送数据获取数据
$task->onWorkerStart = function($task)
{
    $connection_to_access = new AsyncTcpConnection('tcp://'.$GLOBALS.':443');

    // 设置为ssl加密连接
    $connection_to_access->transport = 'ssl';

    Timer::add(10, function()use($task){
        $time_now = time();
        foreach($task->connections as $connection) {
            // 有可能该connection还没收到过消息,则lastMessageTime设置为当前时间
            if (empty($connection_to_access->lastMessageTime)) {
                $connection_to_access->lastMessageTime = $time_now;
                continue;
            }
            // 上次通讯时间间隔大于心跳间隔,则认为客户端已经下线,关闭连接
            if ($time_now - $connection_to_access->lastMessageTime > HEARTBEAT_TIME) {
                $connection_to_access->close();
            }

        }
    });

    $connection_to_access->onConnect = function($connection_to_access)
    {
        echo "connect success\n";

         $connection_to_access->send("GET /ISSNew_e.swf\r\nHost:{$GLOBALS}\r\nUpgrade-Insecure-Requests: 1\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\n\r\n");
    };
2612 2 0
2个回答

continue

请求头信息如附件

  • 暂无评论
walkor 打赏

workerman和swf文件通信,swf发起socket链接连workerman就可以通讯了

  • continue 2017-06-26

    与flash的843端口有联系吗,https

  • continue 2017-06-27

    还是,swf文件不是我这边控制,能不能模拟swf文件与他们的服务器通信

年代过于久远,无法发表回答
×
🔝