}
function isConnect() {
if (!is_null($this->connect))
return true;
else
return false;
}
function close() {
@fclose($this->connect);
}
function startTalk() {
if ($this->connect = fsockopen($this->server, $this->port, $errno, $errstr, 2))
$this->verTalk();
}
function verTalk() // MSN 协议协商 {
$this->put("VER {$this->trID} MSNP9 CVR0 rn");
$data = $this->get();
//echo $data;
if (false !== strripos($data, "VER"))
$this->envTalk();
}
function envTalk() // 环境协商 {
$this->put("CVR {$this->trID} 0x0409 winnt 5.0 i386 MSNMSGR 7.0.0816 MSMSGS {$this-
>userName} rn");
$data = $this->get();
//echo $data;
if (false !== strripos($data, "CVR"))
$this->reqTalk();
}
function reqTalk() // 请求确认 {
$this->put("USR {$this->trID} TWN I {$this->userName} rn");
$data = $this->get(); // XFR 3 NS 207.46.107.41:1863 0 65.54.239.210:1863 XFR 3 NS
207.46.107.25:1863 U D
//echo $data;
if (false !== strripos($data, "XFR")) {
list(, , , $serv) = explode(" ", $data); // 分析服务器
list($ip, $port) = explode(":", $serv); // 分析 IP 和端口
$this->_ip = $ip;
$this->_port = $port;
$this->reLink($ip, $port);
} else {
//echo $data;
//USR3TWNSct=1205292058,rver=5.0.3270.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru
=http:%2F