I have a code that used to work until today. I use a FSocket created via FTcpSocketBuilder(…). The error is in my socket->send(…). As I said, it worked fine, but now it always fails to send data. Any insights to solve this?
FString result;
//Creating socket connection;
FIPv4Endpoint endpoint(FIPv4Address(address[0], address[1], address[2], address[3]), outport);
FSocket* socket = FTcpSocketBuilder(*socketName);
if (!socket->Connect(endpoint.ToInternetAddr().Get()))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString(TEXT("Error connecting to webserver")));
return FString(TEXT("Error connecting to webserver"));
}
//Send the request for the webserver
FBufferArchive buffer;
buffer << request;
int32 sent = 0;
if (!socket->Send(buffer.GetData(), buffer.GetTypeSize(), sent))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Error sending %d bytes of data to webserver: %d.%d.%d.%d:%d"), sent, *(address + 0), *(address + 1), *(address + 2), *(address + 3), outport));
return FString(TEXT("Error sending message webserver"));
}
Yeah, I just reinitialized the pc after realizing some other “zombie” process was using the socket…sight…thank you anyway! Also, I went back to my old “Fstring to uint8*” function, because that one wasn`t working…Looks like the problem is somewhere else now! gonna fix it! thank you! ^^