本文整理汇总了C++中Packet::GetProtocolID方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::GetProtocolID方法的具体用法?C++ Packet::GetProtocolID怎么用?C++ Packet::GetProtocolID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::GetProtocolID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
// Security header
byte* header = new byte[4];
header = "HEAD";
// Protocol ID
CS_Protocol protocol = CS_Protocol::JOIN_GAME;
// Data
byte* data = "My_serialized_packet_data";
// Create a new Packet
Packet* packet = new Packet(header, protocol, data);
std::cout << "Packet Protocol: " << std::endl;
std::cout << packet->GetProtocolID() << std::endl;
std::cout << "Packet Data Length: " << std::endl;
std::cout << packet->GetDataLength() << std::endl;
std::cout << "Packet Data: " << std::endl;
std::cout << packet->GetData() << std::endl << std::endl;
std::cout << "Packet Payload: " << std::endl;
std::cout << packet->GetPayload() << std::endl << std::endl;
std::cout << "Changed Packet Data: " << std::endl;
byte* newData = "This data was changed by packet->SetData();";
packet->SetData(newData);
// Use GetPayload() to return serialized data ready for the networking stream.
std::cout << packet->GetPayload();
for (;;){}
}