Ejemplo n.º 1
0
        public ReplyMessage SendTwoWayMessage(RequestMessage msg)
        {
            msg.Write(tcpclnt.GetStream());

            ReplyMessage reply = new ReplyMessage();
            reply.Read(tcpclnt.GetStream());

            return reply;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used for sending a message that gets a reply such as a query.
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        /// <exception cref="IOException">A reconnect will be issued but it is up to the caller to handle the error.</exception>
        public ReplyMessage SendTwoWayMessage(RequestMessage msg)
        {
            if (this.State != ConnectionState.Opened){
                throw new MongoCommException("Operation cannot be performed on a closed connection.", this);
            }
            try{
                msg.Write(tcpclnt.GetStream());

                ReplyMessage reply = new ReplyMessage();
                reply.Read(tcpclnt.GetStream());
                return reply;
            }catch(IOException){
                this.Reconnect();
                throw;
            }
        }
Ejemplo n.º 3
0
        private void RetrieveMoreData()
        {
            GetMoreMessage gmm = new GetMoreMessage(this.FullCollectionName, this.Id, this.Limit);

            this.reply = connection.SendTwoWayMessage(gmm);
            this.id = this.reply.CursorID;
        }
Ejemplo n.º 4
0
        private void RetrieveData()
        {
            QueryMessage query = BuildQueryMessage();
            if(this.Fields != null){
                query.ReturnFieldSelector = BsonConvert.From(this.Fields);
            }

            this.reply = connection.SendTwoWayMessage(query);
            this.id = this.reply.CursorID;
            if(this.Limit < 0)this.Limit = this.Limit * -1;
        }
Ejemplo n.º 5
0
 private void RetrieveMoreData()
 {
     GetMoreMessage gmm = new GetMoreMessage(this.FullCollectionName, this.Id, this.Limit);
     try{
         this.reply = connection.SendTwoWayMessage(gmm);
         this.id = this.reply.CursorID;
     }catch(IOException ioe){
         this.id = 0;
         throw new MongoCommException("Could not read data, communication failure", this.connection,ioe);
     }
 }
Ejemplo n.º 6
0
 private void RetrieveData()
 {
     QueryMessage query = new QueryMessage();
     query.FullCollectionName = this.FullCollectionName;
     query.Query = BsonConvert.From(this.Spec);
     query.NumberToReturn = this.Limit;
     query.NumberToSkip = this.Skip;
     if(this.Fields != null){
         query.ReturnFieldSelector = BsonConvert.From(this.Fields);
     }
     try{
         this.reply = connection.SendTwoWayMessage(query);
         this.id = this.reply.CursorID;
         if(this.Limit < 0)this.Limit = this.Limit * -1;
     }catch(IOException ioe){
         throw new MongoCommException("Could not read data, communication failure", this.connection,ioe);
     }
 }