飞鸽传书协议:
1:23149:riverlet:127.0.0.1:\x20:balabalabalabala
版本号:包编号:发送者姓名:发送者主机名:命令字:附加信息(消息内容)
<?<span>php </span><span>define</span>("IPMSG_SENDMSG", 0x00000020); <span>//</span><span> 0x00000020 命令字代表不同的命令</span><span> #</span><span>define("IPMSG_SECRETOPT", 0x00000200);// 0x00000200 另一个命令字</span> <span>define</span>("IPMSG_DEFAULTPORT", 2425); <span>//</span><span>2425飞鸽传书端口</span> <span>$sender</span> = 'XXX'<span>; </span><span>$from</span> = '127.0.0.1'<span>; </span><span>$msg_content</span> = 'XXXXXXXXXXXXXXXXXX'<span>; </span><span>$send_to</span> = '192.168.10.110'; <span>//</span><span>对方主机IP</span> <span>$fs</span> = <span>fsockopen</span>("udp://".<span>$send_to</span>, IPMSG_DEFAULTPORT); <span>//</span><span>用户数据报协议,一种无连接的传输层协议</span> <span>fwrite</span>(<span>$fs</span>, "1:".<span>time</span>().":".<span>$sender</span>.":".<span>$from</span>.":".(IPMSG_SENDMSG).":".<span>$msg_content</span><span>); </span><span>fclose</span>(<span>$fs</span>);