/// <summary> /// Creates an instance of <see cref="XmlMessageReader"/> using the /// specified socked. /// </summary> /// <param name="socket"></param> /// <param name="client">This should be the client that created the reader.</param> public XmlMessageReader(Socket socket, XmlMessageClient client) { if (socket == null) throw new ArgumentNullException("socket"); _unproccessedData = new StringBuilder(); _socket = socket; _socket.ReceiveTimeout = 1000; _readBuffer = new byte[BufferSize]; _currentStage = MessageStage.ContentType; _client = client; }
/// <summary> /// Factory method that returns the message processing client. /// </summary> /// <param name="remoteEndpoint">EndPoint (address and port) of the Real-Time Service</param> /// <param name="userName">UserName of the user connecting to the Real-Time Service</param> /// <param name="sessionGuid">GUID of the User's current session</param> /// <param name="timeZone">TimeZone of the User initiating the current session</param> /// <param name="culture">Culture of the User initiating the current session</param> /// <returns>MessageProcessingClient based on the specified parameters</returns> public static IMessageProcessingClient GetMessageProcessingClient(DnsEndPoint remoteEndpoint, string userName, string sessionGuid, Func<TimeZoneInfo> timeZone, CultureInfo culture) { if (remoteEndpoint == null) throw new ArgumentNullException("remoteEndpoint"); if (string.IsNullOrEmpty(userName)) throw new ArgumentNullException("userName"); if (string.IsNullOrEmpty(sessionGuid)) throw new ArgumentNullException("sessionGuid"); // TODO: Fix Warnings var xmlMessageClient = new XmlMessageClient(remoteEndpoint, userName, sessionGuid); var messageProcessingService = new MessageProcessingService(xmlMessageClient); var messageProcessingClient = new MessageProcessingClient(messageProcessingService, timeZone, culture); return messageProcessingClient; }
private static void TestRtl(SessionInfo sessionInfo) { XmlMessageClient xmlMessageClient = new XmlMessageClient(new IPAddress(0x85CD280A), 4502, Config.ValidSuperUserName, sessionInfo.SessionGuid); new MessageProcessingService(xmlMessageClient); Console.WriteLine("Press ESC to stop..."); do { while (!Console.KeyAvailable) { // Do something } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); xmlMessageClient.Stop(); }