コード例 #1
0
        public void Reply(IXdrWritable result)
        {
            RpcMessage reply = this.GenerateReply(AcceptStatus.Success);

            reply.WriteTo(this.xdrWriter);
            result.WriteTo(this.xdrWriter);
        }
コード例 #2
0
        private bool SendMessage(int procedure, int version, IXdrWritable argument, out string errorMessage)
        {
            this.networkWriter.BeginWriting();

            this.rpcMessage.Xid = this.nextXid++;
            this.rpcMessage.Body.CallBody.Procedure = (uint)procedure;
            this.rpcMessage.Body.CallBody.Version   = (uint)version;
            this.rpcMessage.WriteTo(this.xdrWriter);
            argument.WriteTo(this.xdrWriter);

            NetworkWriteResult writeResult = this.networkWriter.EndWriting(this.remoteIpEndPoint);

            if (writeResult.HasError)
            {
                errorMessage =
                    $"Could not send message to {this.remoteIpEndPoint}. Socket error: {writeResult.SocketError}.";
                return(false);
            }

            NetworkReadResult readResult = this.networkReader.BeginReading();

            if (readResult.HasError)
            {
                errorMessage =
                    $"Could not receive reply from {this.remoteIpEndPoint}. Socket error: {readResult.SocketError}.";
                return(false);
            }

            errorMessage = null;
            return(true);
        }