哪有类似下面这个系统的socket代码? 你自己先编好一套通讯协议,就按协议用C/C++写一个服务器端,用PHP写成客户端,对系统要求不高的呀.只是把客户端换种语言来写罢了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请看下面这个socket连接函数,是在我这头客户端的,控制中心告诉我这样肯定能得到返回值,但我一调试就出错,错误指针指在调用sock函数的那行:function sock($puts_type,$puts_value){ global $sock_host,$sock_port,$se_adm_user,$se_adm_pass,$adm_access,$user; //print "$sock_host $sock_port"; $fp=fsockopen("$sock_host","$sock_port",&$errno,&$errstr,1); if(!$fp){ print "<p align=center>网络忙!请稍后再进行连接。</font>"; exit; }else{ /**************************/ //检验权限 if(!$se_adm_user) $aa=$user; else $aa=$se_adm_user; if(!($puts_type=="SendMail" || $puts_type=="CheckProgress")){ $check=sockcheck("ManagerFunction","$aa||$puts_type"); //$check[0]="0000"; //$check[1]="1"; if($check[0]=="0000"){ if($check[1]==0){ print "<p>你没有权限($aa:$puts_type $check[0] $check[1])</p>"; //return; exit; }else $adm_access="$check[1]"; }else{ $err_msg=err($check[0]); print "$err_msg"; exit; } } /**************************/ //print "$adm_access sdf"; $puts_temp="content-type:$puts_type\r\ncontent-length:1024\r\ncontent-value:$puts_value||"; $len=strlen($puts_temp); flush(); $high=dec2hex(floor($len/256)); $low=dec2hex($len%256); $puts="\x02$high$low".$puts_temp; fputs($fp,"$puts",4096); $a1=fgets($fp,128); $a2=fgets($fp,128); $str=fgets($fp,1024); $str1=fgets($fp,1024); if(substr($str1,0,13)=="content-value") $str=$str1; fclose($fp); print "发送:$puts_value"; print "<br>接收: $str $str1"; $str=substr($str,14,strlen($str)-13); $str=trim($str); $row=explode("||",$str); return($row); }} 如何统计一周的信息数量? 我需要获取hotmail邮箱和qqmail的联系点人列表,哪位高手给指点写,谢谢 首页出了点问题,大家进来看下 菜鸟写个简单的CMS 有什么好的建议 一个关于mysql_result()的问题 PHP分页问题 用odbc连接access数据库返回数据问题? 誰想交php朋友呢? 编码风格转换 数组遍历导入mysql的问题请教 缓存问题!!!!!!!!!!!! php4.1.2_win32.zip+win2000+apache怎样安装。
function sock($puts_type,$puts_value){
global $sock_host,$sock_port,$se_adm_user,$se_adm_pass,$adm_access,$user;
//print "$sock_host $sock_port";
$fp=fsockopen("$sock_host","$sock_port",&$errno,&$errstr,1);
if(!$fp){
print "<p align=center>网络忙!请稍后再进行连接。</font>";
exit;
}else{
/**************************/
//检验权限
if(!$se_adm_user) $aa=$user;
else $aa=$se_adm_user; if(!($puts_type=="SendMail" || $puts_type=="CheckProgress")){
$check=sockcheck("ManagerFunction","$aa||$puts_type");
//$check[0]="0000";
//$check[1]="1";
if($check[0]=="0000"){
if($check[1]==0){
print "<p>你没有权限($aa:$puts_type $check[0] $check[1])</p>";
//return;
exit;
}else $adm_access="$check[1]";
}else{
$err_msg=err($check[0]);
print "$err_msg";
exit;
}
}
/**************************/
//print "$adm_access sdf";
$puts_temp="content-type:$puts_type\r\ncontent-length:1024\r\ncontent-value:$puts_value||";
$len=strlen($puts_temp);
flush();
$high=dec2hex(floor($len/256));
$low=dec2hex($len%256);
$puts="\x02$high$low".$puts_temp;
fputs($fp,"$puts",4096);
$a1=fgets($fp,128);
$a2=fgets($fp,128);
$str=fgets($fp,1024);
$str1=fgets($fp,1024);
if(substr($str1,0,13)=="content-value") $str=$str1;
fclose($fp);
print "发送:$puts_value";
print "<br>接收: $str $str1";
$str=substr($str,14,strlen($str)-13);
$str=trim($str);
$row=explode("||",$str);
return($row);
}
}