1.8.0

�ͻ���

��������

��˿ڶ�Э��ʾ����

$serv = new swoole_server("0.0.0.0", 9501);

$port2 = $serv->listen('127.0.0.1', 9502, SWOOLE_SOCK_TCP);

$port2->set(array(
    'open_length_check' => true,
    'package_length_type' => 'N',
    'package_length_offset' => 0,       //��N���ֽ��ǰ����ȵ�ֵ
    'package_body_offset' => 4,       //�ڼ����ֽڿ�ʼ���㳤��
    'package_max_length' => 2000000,  //Э����󳤶�
));

$port2->on('receive',  function (swoole_server $serv, $fd, $from_id, $data)  {
    echo "ServerPort2\n";
});

$serv->on('connect', function ($serv, $fd, $from_id){
    echo "[#".posix_getpid()."]\tClient@[$fd:$from_id]: Connect.\n";
});

$serv->on('receive', function (swoole_server $serv, $fd, $from_id, $data) {
    echo "[#".$serv->worker_id."]\tClient[$fd]: $data\n";
    if ($serv->send($fd, "hello\n") == false)
    {
        echo "error\n";
    }
});

$serv->on('close', function ($serv, $fd, $from_id) {
    echo "[#".posix_getpid()."]\tClient@[$fd:$from_id]: Close.\n";
});

$serv->start();

����

swoole_table����Keyֵ�������ڴ�ռ�ã���table��sizeΪ100��KEYֵ�洢������64M�ڴ�ռ��

�����޸�

�Ƴ�����