bool FTCPTransport::SendPayloadAndReceiveResponse(TArray<uint8>& In, TArray<uint8>& Out) { bool SendResult = false; #if USE_MCSOCKET_FOR_NFS SendResult = FNFSMessageHeader::WrapAndSendPayload(In, FSimpleAbstractSocket_FMultichannelTCPSocket(MCSocket, NFS_Channels::Main)); #else SendResult = FNFSMessageHeader::WrapAndSendPayload(In, FSimpleAbstractSocket_FSocket(FileSocket)); #endif if (!SendResult) return false; FArrayReader Response; bool RetResult = false; #if USE_MCSOCKET_FOR_NFS RetResult = FNFSMessageHeader::ReceivePayload(Response, FSimpleAbstractSocket_FMultichannelTCPSocket(MCSocket, NFS_Channels::Main)); #else RetResult = FNFSMessageHeader::ReceivePayload(Response, FSimpleAbstractSocket_FSocket(FileSocket)); #endif if (RetResult) { Out.Append( Response.GetData(), Response.Num()); return true; } return false; }
virtual bool SendPayload( TArray<uint8> &Out ) override { #if USE_MCSOCKET_FOR_NFS return FNFSMessageHeader::WrapAndSendPayload(Out, FSimpleAbstractSocket_FMultichannelTCPSocket(MCSocket, NFS_Channels::Main)); #else return FNFSMessageHeader::WrapAndSendPayload(Out, FSimpleAbstractSocket_FSocket(Socket)); #endif }
virtual uint32 Run() override { while (!StopRequested.GetValue()) { // read a header and payload pair FArrayReader Payload; if (!FNFSMessageHeader::ReceivePayload(Payload, FSimpleAbstractSocket_FSocket(Socket))) break; // now process the contents of the payload if ( !FNetworkFileServerClientConnection::ProcessPayload(Payload) ) { // give the processing of the payload a chance to terminate the connection // failed to process message UE_LOG(LogFileServer, Warning, TEXT("Unable to process payload terminating connection")); break; } } return true; }