You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* All standard buffers now implement IComputeBuffer directly, and do not need to have ToSharedInstance() called to create a ref-counted version. * Workers can now construct a socket directly, allowing multiple buffers to be attached. * Control messages are sent whenever a receive buffer is attached, allowing the remote to wait for it to be available. #preflight none [CL 25169238 by Ben Marsh in ue5-main branch]
49 lines
832 B
C++
49 lines
832 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include <iostream>
|
|
#include "ComputeChannel.h"
|
|
#include "SharedMemoryBuffer.h"
|
|
|
|
int main()
|
|
{
|
|
FComputeSocket Socket;
|
|
if (!Socket.Open())
|
|
{
|
|
std::cout << "Environment variable not set correctly" << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
FComputeChannel Channel;
|
|
if (!Channel.Open(Socket, FComputeChannel::DefaultWorkerChannelId))
|
|
{
|
|
std::cout << "Unable to create channel to host" << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
std::cout << "Connected to client" << std::endl;
|
|
|
|
size_t Length = 0;
|
|
char Buffer[4];
|
|
|
|
for (;;)
|
|
{
|
|
size_t Read = Channel.Receive(Buffer + Length, sizeof(Buffer) - Length);
|
|
if (Read == 0)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
Length += Read;
|
|
|
|
if (Length >= 4)
|
|
{
|
|
std::cout << "Read value " << *(int*)Buffer << std::endl;
|
|
Length = 0;
|
|
}
|
|
}
|
|
|
|
Channel.Close();
|
|
return 0;
|
|
}
|
|
|