public ClientAdapterResponse SendRpc(ClientMessage message, int timeout) { if (InvokeRequired) { log.Error("SendRpc must be called on client thread."); return(null); } else { sendMutex.WaitOne(); // // Set the RPC timer to fire in timeout seconds. // timer.Change(timeout, Timeout.Infinite); // // Do the rpc -- Send / Recv // if (log.IsDebugEnabled) { log.Debug(" <-s- " + message.ToMessage(session_id).ToString()); } rpc.Send(message.ToMessage(session_id).ToByteArray()); ClientAdapterResponse response = ClientAdapterResponse.ParseFrom(rpc.Recv( )); timer.Change(Timeout.Infinite, Timeout.Infinite); sendMutex.ReleaseMutex(); if (log.IsDebugEnabled) { log.Debug(" -r-> " + response.ToString()); } return(response); } }