UE4 Sockets HasPendingData() false before data is finished

I have been using the Unreal FSocket to send and receive data. For some reason I’ve never been able to get valid behavior from socket->HasPendingData(). Even when I gather data from socket->Recv() the HasPendingData() has been false.

My hacky workaround was to stop receiving data when I’ve read 0 from socket->Recv(), but this fails for larger sets of data (over 1mb)’

Any ideas on how to get the socket interface to operate correctly?

Here is some example code of what I’m doing.

 // in init
    mListener = new FTcpListener(FIPv4Endpoint(internetAddress));
    mListener->OnConnectionAccepted().BindRaw(this, &LocalNetworking::handleIncomingConnection);

    bool LocalNetworking::handleIncomingConnection(FSocket* socket, const FIPv4Endpoint& clientEndpoint)
		TArray<TArray<uint8>> receivedData;
	const int32 recvSize = 8192;
	int32 lastRead = 0;
	int32 totalRead = 0;

	//blocking wait to help ensure we don't drop data
	socket->Wait(ESocketWaitConditions::WaitForRead, FTimespan::FromSeconds(5));
	// read will 0 out when finished with data...
	uint32 read = 0;
	//while (read !=0)
	while (socket->HasPendingData(read))
		int32 received = 0;
		TArray<uint8> partialData;
		partialData.Init(0, recvSize);
		socket->Recv(partialData.GetData(), partialData.Num(), received);
		totalRead += received;
		if (read > 0)
			if (received < recvSize)

	// consolidate all the chunks of data into one string
	FString data;
	for (auto& partial : receivedData)
		// maybe a better way to do this?
		const std::string cstr(reinterpret_cast<const char*>(partial.GetData()), partial.Num());
		data += FString(cstr.c_str());


When processing data, I typically receive around 10000 - 15000 bytes ( out of 1mb) before HasPendingData() return false.