本文整理汇总了C++中Packet::Data方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::Data方法的具体用法?C++ Packet::Data怎么用?C++ Packet::Data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::Data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Send
void TCPClient::Send(Packet & packet)
{
if (!m_Socket) {
LOG_WARNING("TCPClient::Send: Socket is null");
return;
}
packet.UpdateSize();
boost::system::error_code error;
m_Socket->send(boost::asio::buffer(
packet.Data(),
packet.Size()), 0, error);
}
示例2:
//@data: TS packet
int MP2TMuxer::DeliverPacket(Packet &packet){
unsigned short pid = packet.PID();
if(this->mpDeliverer){
mPSIPeriod -= 1;
packet.SetCC(mContinuityCounter[pid]);
int ret = this->mpDeliverer->Deliver((const char *)packet.Data(), Packet::PACKET_LENGTH);
packet.Reset();
mContinuityCounter[pid] = packet.GetCC();
return ret;
}
if (mDeliverer) {
mPSIPeriod -= 1;
packet.SetCC(mContinuityCounter[pid]);
int ret = this->mDeliverer((const unsigned char *)packet.Data(), Packet::PACKET_LENGTH, mDeliverHandler);
packet.Reset();
mContinuityCounter[pid] = packet.GetCC();
}
return 0;
}
示例3: WritePacketData
void Packet::WritePacketData(Packet &packet) {
if (packet.Length() == 0) return;
data.resize(data.size() + packet.Length());
memcpy(&data[data.size() - packet.Length()], packet.Data(), packet.Length());
}