swoole_client::__construct
����ԭ�ͣ�
swoole_client->__construct(int $sock_type, int $is_sync = SWOOLE_SOCK_SYNC, string $key);
����ʹ��swoole�ṩ�ĺ���ָ֮�����ͣ���ο� swoole��������
- $sock_type��ʾsocket�����ͣ���TCP/UDP
- $is_sync��ʾͬ�����������첽��������Ĭ��Ϊͬ������
- $key���ڳ����ӵ�Key��Ĭ��ʹ��IP:PORT��Ϊkey����ͬkey�����ӻᱻ����
��php-fpm/apache�д��������ӣ�
$cli = new swoole_client(SWOOLE_TCP | SWOOLE_KEEP);
����SWOOLE_KEEP��־������TCP������PHP����������ߵ���$cli->closeʱ������رա���һ��ִ��connect����ʱ�Ḵ����һ�δ��������ӡ������ӱ���ķ�ʽĬ������ServerHost:ServerPortΪkey�ġ������ٵ�3��������ָ��key��
swoole_client��unsetʱ���Զ�����close�����ر�socket
�첽ģʽunsetʱ���Զ��ر�socket����epoll�¼���ѯ���Ƴ�
SWOOLE_KEEP������ģʽ��1.6.12����ã������ӵ�$key������1.7.5������
��swoole_server��ʹ��swoole_client
- �������¼��ص�������ʹ��swoole_client��������
swoole_server->start
ǰ���� - swoole_server�������κ����Ա�д�� socket client�����ӡ�ͬ��swoole_clientҲ����ȥ�����κ����Ա�д��socket server��