//socke操作类
class Socket {
private $host;//连接socket的主机
private $port;//socket的端口号
private $error=array();
private $socket=null;//socket的连接标识
private $queryStr="";//发送的数据
public function __construct($host,$port) {
if(!extension_loaded("sockets")){
exit("请打开socket扩展 ");
}
if(empty($host)) exit("请输入目标地址");
if(empty($port)) exit("请输入有效的端口号");
$this->host=$host;
$this->port=$port;
$this->CreateSocket();//创建连接
}
//创建socket
private function CreateSocket(){
!$this->socket&&$this->socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP);//创建socket
$r=@socket_connect($this->socket,$this->host,$this->port);
if($r){
return $r;
}else{
$this->error[]=socket_last_error($this->socket);
return false;
}
}
//向socket服务器写入数据并读取
public function wr($contents){
$this->queryStr="";
$this->queryStr=$contents;
!$this->socket&&$this->CreateSocket();
$contents=$this->fliterSendData($contents);
$result=socket_write($this->socket,$contents,strlen($contents));
if(!intval($result)){
$this->error[]=socket_last_error($this->socket);
return false;
}
$response=socket_read($this->socket,12048);
if(false===$response){
$this->error[]=socket_last_error($this->socket);
return false;
}
return $response;
}
//对发送的数据进行过滤
private function fliterSendData($contents){
//对写入的数据进行处理
return $contents;
}
//所有错误信息
public function getError(){
return $this->error;
}
//最后一次错误信息
public function getLastError(){
return $this->error(count($this->error));
}
//获取最后一次发送的消息
public function getLastMsg(){
return $this->queryStr;
}
public function getHost(){
return $this->host;
}
public function getPort(){
return $this->port;
}
//关闭socket连接
private function close(){
$this->socket&&socket_close($this->socket);//关闭连接
$this->socket=null;//连接资源初始化
}
public function __destruct(){
$this->close();
}
}
本系统经过多次升级改造,系统内核经过多次优化组合,已经具备相对比较方便快捷的个性化定制的特性,用户部署完毕以后,按照自己的运营要求,可实现快速定制会费管理,支持在线缴费和退费功能财富中心,管理会员的诚信度数据单客户多用户登录管理全部信息支持审批和排名不同的会员级别有不同的信息发布权限企业站单独生成,企业自主决定更新企业站信息留言、询价、报价统一管理,分系统查看分类信息参数化管理,支持多样分类信息,
0
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号