ObjectDeliverer
v1.5.1
https://www.unrealengine.com/marketplace/ja/slug/objectdeliverer
ObjectDeliverer是Unreal Engine(C++,Blueprint)的数据传输/接收库。
它具有以下特点。
master分支可使用UE5 5.0或更高版本构建; UE4 需要进行一些修改才能构建。
以下协议可与内置协议一起使用。您还可以添加自己的协议。
以下规则可用于内置的发送和接收数据的分割规则。
固定尺寸
例)固定1024字节的情况
标头(正文尺寸)+正文
示例)当大小区域为 4 字节时
按端子符号分割
示例)当 0x00 为结束时
void UMyClass::Start ()
{
auto deliverer = UObjectDelivererManager::CreateObjectDelivererManager ();
// bind connected event
deliverer-> Connected . AddDynamic ( this , &UMyClass::OnConnect);
// bind disconnected event
deliverer-> Disconnected . AddDynamic ( this , &UMyClass::OnDisConnect);
// bind receive event
deliverer-> ReceiveData . AddDynamic ( this , &UMyClass::OnReceive);
// start deliverer
// + protocol : TCP/IP Server
// + Data division rule : Header(BodySize) + Body
// + Serialization method : Byte Array
deliverer-> Start ( UProtocolFactory::CreateProtocolTcpIpServer ( 9099 ),
UPacketRuleFactory::CreatePacketRuleSizeBody ());
}
void UMyClass::OnConnect (UObjectDelivererProtocol* ClientSocket)
{
// send data
TArray<uint8> buffer;
deliverer-> Send (buffer);
}
void UMyClass::OnDisConnect (UObjectDelivererProtocol* ClientSocket)
{
// closed
UE_LOG (LogTemp, Log, TEXT ( " closed " ));
}
void UMyClass::OnReceive (UObjectDelivererProtocol* ClientSocket, const TArray<uint8>& Buffer)
{
// received data buffer
}
查看维基 https://github.com/ayumax/ObjectDeliverer/wiki