Example #1
0
        public int GetPort(int program, int version, PortMapperProtocol protocol)
        {
            MemoryStream  ms     = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, null, NfsProc3.Lookup);

            writer.Write(program);
            writer.Write(version);
            writer.Write((uint)protocol);
            writer.Write((uint)0);

            RpcReply reply = DoSend(ms);

            if (reply.Header.IsSuccess)
            {
                return((int)reply.BodyReader.ReadUInt32());
            }
            throw new RpcException(reply.Header.ReplyHeader);
        }
Example #2
0
        public int GetPort(int program, int version, PortMapperProtocol protocol)
        {
            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, null, 3);
            writer.Write(program);
            writer.Write(version);
            writer.Write((uint)protocol);
            writer.Write((uint)0);

            RpcReply reply = DoSend(ms);
            if (reply.Header.IsSuccess)
            {
                return (int)reply.BodyReader.ReadUInt32();
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }