public void TransmitData(TcpExchangeHub hub, TcpRelayDirection direction, byte[] data, int count) { foreach (var logger in this._loggers) { logger.TransmitData(hub, direction, data, count); } }
public void Disconnected(TcpExchangeHub hub, TcpRelayDirection direction) { if (direction == TcpRelayDirection.ClientToRelay) { Interlocked.Decrement(ref this._connectedClients); } }
public void Disconnected(TcpExchangeHub hub, TcpRelayDirection direction) { foreach (var logger in this._loggers) { logger.Disconnected(hub, direction); } }
public void TransmitData(TcpExchangeHub hub, TcpRelayDirection direction, byte[] data, int count) { var hex = new string[data.Length]; var charRep = new string[count]; for (int i = 0; i < data.Length; i++) { hex[i] = " "; } for (int i = 0; i < count; i++) { var c = (char)data[i]; hex[i] = data[i].ToString("X2"); charRep[i] = (char.IsControl(c) || char.IsWhiteSpace(c)) ? "." : c.ToString(CultureInfo.InvariantCulture); } string info = string.Format("{0} {1}", string.Join(" ", hex), string.Join(" ", charRep) ); this.WriteLine(hub, direction, info); }
private static void WriteLine(TcpExchangeHub hub, TcpRelayDirection direction, string information) { Console.WriteLine("{0:HH:mm:ss.ff} {1} {2} {3}", DateTime.Now, TcpDataLoggerHelper.GetDirectionShortCode(direction), TcpDataLoggerHelper.GetShortInstanceName(hub), information); }
public void TransmitData(TcpExchangeHub hub, TcpRelayDirection direction, byte[] data, int count) { var hex = new string[count]; for (int i = 0; i < count; i++) { hex[i] = data[i].ToString("X2"); } string info = string.Join(" ", hex); WriteLine(hub, direction, info); }
public void TransmitData(TcpExchangeHub hub, TcpRelayDirection direction, byte[] data, int count) { if (!this._transmissionSubject.HasObservers) { return; } var subject = new TransmissionSummary { Hub = hub, ByteCount = count, Direction = direction, }; this._transmissionSubject.OnNext(subject); }
private void WriteLine(TcpExchangeHub hub, TcpRelayDirection direction, string message) { this.EnsureIsInitialized(); DateTime dt = DateTime.Now; lock (this._lockObject) { this._fileWriter.WriteLine("{0:yyyy-MM-dd HH:mm:ss.fff} {1} {2}+ {3}", dt, TcpDataLoggerHelper.GetShortInstanceName(hub), TcpDataLoggerHelper.GetDirectionShortCode(direction), message ); } }
public Context(Socket incomingSocket, Socket outgoingSocket, TcpRelayDirection direction) { this.IncomingSocket = incomingSocket; this.OutgoingSocket = outgoingSocket; this.Direction = direction; }
public void Disconnected(TcpExchangeHub hub, TcpRelayDirection direction) { WriteLine(hub, direction, "Disconnected"); }
public static string GetDirectionShortCode(TcpRelayDirection direction) { return(direction == TcpRelayDirection.ClientToRelay ? "C" : "R"); }
public static string GetDirectionShortCode(TcpRelayDirection direction) { return direction == TcpRelayDirection.ClientToRelay ? "C" : "R"; }