public void SendMessage(RequestMessage msg) { msg.Write(tcpclnt.GetStream()); }
/// <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; } }
public ReplyMessage SendTwoWayMessage(RequestMessage msg) { msg.Write(tcpclnt.GetStream()); ReplyMessage reply = new ReplyMessage(); reply.Read(tcpclnt.GetStream()); return reply; }
/// <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; } }