Description of Message.
상속: Message
예제 #1
0
 public void SendMessage(RequestMessage msg)
 {
     msg.Write(tcpclnt.GetStream());
 }
예제 #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;
            }
        }
예제 #3
0
        public ReplyMessage SendTwoWayMessage(RequestMessage msg)
        {
            msg.Write(tcpclnt.GetStream());

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

            return reply;
        }
예제 #4
0
        /// <summary>
        /// Used for sending a message that gets no reply such as insert or update.
        /// </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 void SendMessage(RequestMessage msg)
        {
            if (this.State != ConnectionState.Opened){
                throw new MongoCommException("Operation cannot be performed on a closed connection.", this);
            }
            try{
                msg.Write(tcpclnt.GetStream());

            }catch(IOException){//Sending doesn't seem to always trigger the detection of a closed socket.
                this.Reconnect();
                throw;
            }
        }