SetTimer cannot compile due to... Nothing?

Error C:\Users\Chilly\Documents\Unreal Projects\Project_Zarus_MMO\Source\Project_Zarus_MMO\UDPSender.cpp(28) : note: see reference to function template instantiation ‘TFunction::TFunction(FunctorType &&)’ being compiled
Info with
Info [
Info FunctorType=void (__cdecl AUDPSender::* )(void)
Info ]

The above info is what is confusing me. To myself this is not saying much of anything other than “yep… we’re compiling that function now”

I am trying to rebuild an old UDPSender and Receiver, however I cannot wrap my head around this error.

It occurs here:

bool AUDPSender::StartTCPReceiver(
	const FString& YourChosenSocketName,
	const FString& TheIP,
	const int32 ThePort
) {
	ListenerSocket = CreateTCPConnectionListener(YourChosenSocketName, TheIP, ThePort);

	if (!ListenerSocket)
	{
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("StartTCPReceiver>> Listen socket could not be created! ~> %s %d"), *TheIP, ThePort));
		return false;
	}

	FTimerHandle TCPReceiver;
	GetWorldTimerManager().SetTimer(TCPReceiver, &AUDPSender::TCPConnectionListener, 1.0f, false);

	return true;
}

This here is the function that it calls &AUDPSender::TCPConnectionListener

void AUDPSender::TCPConnectionListener()
{
	if (!ListenerSocket) return;

	// Remote Address
	TSharedRef<FInternetAddr> RemoteAddress = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
	bool Pending;

	// Handle Incomming Connections
	if (ListenerSocket->HasPendingConnection(Pending) && Pending)
	{
		if (ConnectionSocket)
		{
			ConnectionSocket->Close();
			ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->DestroySocket(ConnectionSocket);
		}

		//New Connection Received!
		ConnectionSocket = ListenerSocket->Accept(*RemoteAddress, TEXT("TCP Received Socket Connection"));

		if (ConnectionSocket != NULL)
		{
			RemoteAddressForConnection = FIPv4Endpoint(RemoteAddress);
			FTimerHandle TCPListener;
			GetWorldTimerManager().SetTimer(TCPListener, &AUDPSender::TCPSocketListener, 0.01, true);
		}
	}
}

Anywho, thank you for any help that can be provided, a pastebin with all of the error log is linked below.

Hi,

what you pasted in your question ist just a small part of the error message. The note: lines always belong to the next error line above. Which is saying:

 Info C:\Program Files (x86)\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Templates\Function.h(238): error C2672: 'Invoke': no matching overloaded function found

Which means you are calling a function that does not exist. I assume that line 28 in your code is this

GetWorldTimerManager().SetTimer(TCPReceiver, &AUDPSender::TCPConnectionListener, 1.0f, false);

which should be

GetWorldTimerManager().SetTimer(TCPReceiver, this, &AUDPSender::TCPConnectionListener, 1.0f, false);

out of my mind, could you try this?

Understanding the wallpapers of error messages that the compiler produces when templates are involved is indeed difficult and needs some time of learning and experience.

Awesome! That was it! Thank you for showing me this, I love and hate errors like this since they always give me something new to learn :slight_smile: