Blogger Information
Blog 14
fans 0
comment 0
visits 15024
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP&SOCKET长连接
krasenChen的博客
Original
1585 people have browsed it

Resource socket_create(int protocol, int socketType, int commonProtocol);  //参数1,协议, 2,socket类型, 3,公共协议   成功返回资源类型, 否返回false

<?php
//产生,接受,监听socket
$commonProtocol = getprotobyname("tcp");  //使用公共协议名字来获取一个协议类型
$socket = $socket_create(AF_INET, SOCK_STREAM, $commonProtocol); //产生一个socket资源实例
socket_bind($socket, 'localhost', 1337);  //绑定socket到本地计算机和绑定端口1337
socket_listen($socket);       //监听所有进来的socket连接



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post