FSocket->Recv no data response

I’ve added some tests in the listening delegate:


void AYagActor::ListenToResponse()
{
	if (ConnectionSocket->GetConnectionState() == ESocketConnectionState::SCS_Connected) GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, FString::Printf(TEXT("CLIENT CONNECTED")));
	if (ConnectionSocket->GetConnectionState() == ESocketConnectionState::SCS_NotConnected) GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, FString::Printf(TEXT("CLIENT NOT CONNECTED")));
	if (ConnectionSocket->GetConnectionState() == ESocketConnectionState::SCS_ConnectionError) GEngine->AddOnScreenDebugMessage(-1, 30.f, FColor::Red, FString::Printf(TEXT("CLIENT CONNECTION ERROR")));

// rest of the code
	...]
}

This gives me the “connection error” message.

So no wonder i don’t get any response inside this delegate.

In any other function than this delegate, the socket is connected but i can’t wait for the message to arrive.

I tried to get rid of the timer and use instead the wait() function in blocking mode (with a time out) but it displays no message during its waiting period (and i still get no response during or after the wait call).

  • is there something special with timer/delegates and sockets ? i don’t know how timers work, is it possible that the (class variable) ConnectionSocket is unknown to the delegate ?
  • is there a way to get a more precise error code ?

Thanks

Cedric