FUdpSocketReceiver not receiving data

Hi everyone,

I’ve been working on a UDP plugin with 4.10.2 version. Once everything worked great, I sent the plugin to a friend who had engine 4.12.5 and udp receiver stopped working. Afterwards I’ve downloaded 4.12.5 after building the thing from scratch, no incoming data (still works on 4.10.2).

Been banging my head the whole day today with no luck.

Even Rama’s simple receiver and sender don’t work. Is there a firewall-like functionality enabled or something? Wireshark receives packages, but unreal plugin is silent.


FTimespan ThreadWaitTime = FTimespan::FromMilliseconds(100);
UDPReceiver = new FUdpSocketReceiver(ListenSocket, ThreadWaitTime, TEXT("UDP RECEIVER"));
UDPReceiver->OnDataReceived().BindUObject(this, &ARamaUDPReceiver::Recv); 

Events work, Functions work, Sender works; everything but Receiver. What am I missing here?

Thanks

After further investigation, engine networking header files do not match for some reason. Working on it.

In earlier versions of engine, the thread was created in its constructor. Adding


Receiver->Start();

got it working again.

Don’t forget to call


Receiver->Stop();

at the end.

Thank you very much dude

Thx for ur advice, i had also add the
Receiver->Start(); But nothing happend : (

Where do you add Receiver->Start()? I can’t seem to figure it out.

Add to the bottom line of function bool AUDPReceiver::StartUDPReceiver(const FString& YourChosenSocketName, const FString& TheIP, const int32 ThePort) as below:


//Rama's Start TCP Receiver
bool AUDPReceiver::StartUDPReceiver(
const FString& YourChosenSocketName,
const FString& TheIP,
const int32 ThePort
) {

ScreenMsg("RECEIVER INIT");

//~~~

FIPv4Address Addr;
FIPv4Address::Parse(TheIP, Addr);

//Create Socket
FIPv4Endpoint Endpoint(Addr, ThePort);

//BUFFER SIZE
int32 BufferSize = 2 * 1024 * 1024;

ListenSocket = FUdpSocketBuilder(*YourChosenSocketName)
.AsNonBlocking()
.AsReusable()
.BoundToEndpoint(Endpoint)
.WithReceiveBufferSize(BufferSize);
;

FTimespan ThreadWaitTime = FTimespan::FromMilliseconds(100);
UDPReceiver = new FUdpSocketReceiver(ListenSocket, ThreadWaitTime, TEXT("UDP RECEIVER"));

UDPReceiver->OnDataReceived().BindUObject(this, &AUDPReceiver::Recv);
UDPReceiver->Start();

return true;
}

I have done everything that this thread and Rama’s tutorial has said to do, and I cannot, for the life of me get my receiver to start reading messages.

Same here… Did you get it to work at some point?