A whole lot of troubles with sockets and TCP

So, I’ve made a tcp client with both sender and receiver capabilities, based on Rama’s UDP client. The only thing I changed is this line

SenderSocket = FUdpSocketBuilder(*YourChosenSocketName).AsReusable().WithBroadcast();

To FTcpSocketBuilder (omitting .WithBradcast() in the way). Also, SendTo() doesn’t actually work without first doing

senderSocket->Connect(*remoteAdress);

HOWEVER

Recv() works very strange. bytesPending equals 8 bytes, the message that was sent to me by server. Hovever bytesRead goes 0. Why can’t it read anything, though it totaly came through.

ALSO

Send() doesn’t actually deliver anything. It’s not “not sending”, because bytesSent is 12. But server doesn’t actually get anything. When I tried to send something to server through unity it was delivered, that’s why I think the problem is in my code.

Half the problem solved itself, somehow. By changing Send() to SendTo() I managed to get my message to server, though I can’t tell why it behaves like that.

Have you found a fix to this?

And now, Send and SentTo do send message to my server but not at once this function is called, but delay to application shutting down.
so strange.