public LinuxTcpStatistics(bool ipv4) { _table = StringParsingHelpers.ParseTcpGlobalStatisticsFromSnmpFile(NetworkFiles.SnmpV4StatsFile); string sockstatFile = ipv4 ? NetworkFiles.SockstatFile : NetworkFiles.Sockstat6File; string protoName = ipv4 ? "TCP" : "TCP6"; _currentConnections = StringParsingHelpers.ParseNumSocketConnections(sockstatFile, protoName); }
public static void TcpGlobalStatisticsParsing() { FileUtil.NormalizeLineEndings("snmp", "snmp_normalized2"); TcpGlobalStatisticsTable table = StringParsingHelpers.ParseTcpGlobalStatisticsFromSnmpFile("snmp_normalized2"); Assert.Equal(1, table.RtoAlgorithm); Assert.Equal(200, table.RtoMin); Assert.Equal(120000, table.RtoMax); Assert.Equal(-1, table.MaxConn); Assert.Equal(359, table.ActiveOpens); Assert.Equal(28, table.PassiveOpens); Assert.Equal(2, table.AttemptFails); Assert.Equal(53, table.EstabResets); Assert.Equal(4, table.CurrEstab); Assert.Equal(21368, table.InSegs); Assert.Equal(20642, table.OutSegs); Assert.Equal(19, table.RetransSegs); Assert.Equal(0, table.InErrs); Assert.Equal(111, table.OutRsts); Assert.Equal(0, table.InCsumErrors); }
public void TcpGlobalStatisticsParsing() { string fileName = GetTestFilePath(); FileUtil.NormalizeLineEndings("NetworkFiles/snmp", fileName); TcpGlobalStatisticsTable table = StringParsingHelpers.ParseTcpGlobalStatisticsFromSnmpFile(fileName); Assert.Equal(1L, table.RtoAlgorithm); Assert.Equal(200L, table.RtoMin); Assert.Equal(120000L, table.RtoMax); Assert.Equal(-1L, table.MaxConn); Assert.Equal(359L, table.ActiveOpens); Assert.Equal(28L, table.PassiveOpens); Assert.Equal(2L, table.AttemptFails); Assert.Equal(53L, table.EstabResets); Assert.Equal(4L, table.CurrEstab); Assert.Equal(2592159585L, table.InSegs); Assert.Equal(2576867425L, table.OutSegs); Assert.Equal(19L, table.RetransSegs); Assert.Equal(0L, table.InErrs); Assert.Equal(111L, table.OutRsts); Assert.Equal(0L, table.InCsumErrors); }