Download

Beacon pass data from server to client?

I have a basic beacon working. But I’m unable to get it to pass data from the server back to the client in response to a query. Everything is executing, but the returned data is always blank (zeros). What am I doing wrong?

-------------------------------------------- .h --------------------------

/** test data to send in reply **/
USTRUCT()
struct FServerDataReply
{
GENERATED_USTRUCT_BODY()

// The Server’s name
int32 Name;

// The Server IP Address
int32 IP;
};

class MTGAME_API AWFServerBeaconClient : public AOnlineBeaconClient
{
GENERATED_UCLASS_BODY()

UFUNCTION(client, reliable)
virtual void ClientPing(FServerDataReply ReplyData);

UFUNCTION(server, reliable, WithValidation)
virtual void ServerPong();
};

--------------------------------------------------.cpp ---------------------------------------

/** ServerPong rpc implementation **/
//-----------------------------------------------------------------------------
void AWFServerBeaconClient::ServerPong_Implementation()
{
UE_LOG(FBeaconLog, Log, TEXT(“Pong RPC Called”));

//Send ping rpc back to client
FServerDataReply ReplyData;

ReplyData.IP = 111;
ReplyData.Name = 222;

ClientPing(ReplyData);
}

/** The rpc client ping implementation */
//-----------------------------------------------------------------------------
void AWFServerBeaconClient::ClientPing_Implementation(FServerDataReply ReplyData)
{
UE_LOG(FBeaconLog, Log, TEXT(“ClientPing_Implementation:: Ping RPC Called”));

UE_LOG(FBeaconLog, Log, TEXT(“1: %i”), ReplyData.IP);
UE_LOG(FBeaconLog, Log, TEXT(“2: %i”), ReplyData.Name);
}