Download

OnDataUpdated.Broadcast() exception

I start a thread to receive data from other Udp Clients after initiating the Udp socket.The following code is the thread for recieving data.
Once a piece of data comes,I used ‘OnDataUpdated.Broadcast(HappyString)’ to send the data to the blueprint.
This works well for about twenty minutes.However,an exception occurs after a short time.
![SKHQ~N@IKON3S{}H8`T]%E2.png|555x352](upload://zinSzpY2ZnSyS6F5AeoYewghUh5.png)
![GTDXG~6WLE[62K{EFJQTKV.png|768x383

DWORD32 WINAPI MyStartReceiveData(LPVOID myparam)
{
AMyActorUdp* pDlg = (AMyActorUdp*)myparam;
dwSendSize1 = sizeof(SOCKADDR_IN);
int32 commaStart = 0;
int32 i = 0;
int32 j = 0;

char* pszRecv = new char[4096];

while (true)
{

	if (pDlg->isend)
	{
		delete]  pszRecv;
		return 0;
	}
	 

	nRet1 = recvfrom(sockClient1, pszRecv, 4096, 0, (SOCKADDR*)&siRemote1, &(dwSendSize1));
	if (nRet1 == SOCKET_ERROR) {
		cout << "recvfrom Error " << WSAGetLastError() << endl;
                    delete]  pszRecv;
		return -1;
	}
	else if (nRet1 == 0) {
		 
	}
	else{
		pszRecv[nRet1] = '\0';
		cout << inet_ntoa(siRemote1.sin_addr) << endl
			<< pszRecv << endl;

		FString HappyString = UTF8_TO_TCHAR(pszRecv);
		pDlg->OnDataUpdated.Broadcast(HappyString);
	}

}
delete]  pszRecv;
return 0;

}