本文介绍了[转发]我如何通过udp发送对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i有两个数据包类,
1- CommandPacket:
class CommandPacket {
/ * * @var CommandPacketHeader * /
private $ header ;
private $ data ;
}
和2- CommandPacketHeader:
class CommandPacketHeader {
/ * * @var integer Cardinal * /
private $ headerSize ;
/ * * @var数组描述* /
private $签名跨度>;
/ * * @var integer Cardinal * /
private $版本跨度>;
/ * * @var整数UInt64 * /
private $ highSessionID 跨度>;
/ * * @var整数描述* /
private $ lowSessionID 跨度>;
/ * * @var integer enum * /
private $ commandID 跨度>;
/ * * @var integer Cardinal * /
private $命令datasize 跨度>;
}
我想知道如何将一个对象拆分成块并用socket_sendto函数发送它们?
解决方案
hi,
i have two packet Classes ,
1- CommandPacket:
class CommandPacket { /** @var CommandPacketHeader */ private $header; private $data; }
and 2- CommandPacketHeader :
class CommandPacketHeader { /** @var integer Cardinal */ private $headerSize; /** @var array Description */ private $signature; /** @var integer Cardinal */ private $version; /** @var integer UInt64 */ private $highSessionID; /** @var integer Description */ private $lowSessionID; /** @var integer enum */ private $commandID; /** @var integer Cardinal */ private $dataSize; }
I want to know how can i split an object into chunks and send them with socket_sendto function?
socket_sendto( resource $socket , string $buf , int $len , int $flags , string $addr [, int $port = 0 ] )
解决方案
这篇关于[转发]我如何通过udp发送对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!