private int RefreshTable() { // Remove all current rows in the table for (int i = (tcpTable.Rows.Count - 1); i > 0; i--) { tcpTable.Rows.RemoveAt(i); } TCPInfo.MIB_TCPROW_OWNER_PID[] tcpConnTable = TCPInfo.GetAllTcpConnections(); for (int i = 0; i < tcpConnTable.Count(); i++) { DataRow tempRow = tcpTable.NewRow(); tempRow[0] = tcpConnTable[i].owningPid; tempRow[1] = REVERSERIZER(IPAddress.Parse(tcpConnTable[i].localAddr.ToString()).ToString()); tempRow[2] = REVERSERIZER(IPAddress.Parse(tcpConnTable[i].remoteAddr.ToString()).ToString()); tempRow[3] = tcpConnTable[i].LocalPort; tempRow[4] = tcpConnTable[i].RemotePort; tempRow[5] = GetTCPState(tcpConnTable[i].state); tcpTable.Rows.Add(tempRow); } return(tcpConnTable.Count()); }
public MonitorOutput GetSystemInfo() { MonitorOutput monitorOutput = new MonitorOutput() { CPUInfo = CPUInfo.GetCPUInfo(), MemInfo = MemoryInfo.GetMemInfo(), TCPCount = TCPInfo.GetTCPCount() }; return(monitorOutput); }
public void GetMonitorInfo() { MonitorOutput monitorOutput = new MonitorOutput() { CPUInfo = CPUInfo.GetCPUInfo(), MemInfo = MemoryInfo.GetMemInfo(), TCPCount = TCPInfo.GetTCPCount(), OnlineCount = OnlineInfo.GetOnlineCount() }; Clients.All.getMonitorInfo(monitorOutput); }
private void NetworkMonitor_Advanced_Load(object sender, EventArgs e) { tcpTable = new DataTable("tcp_info"); // Initialize the data table with columns tcpTable.Columns.Add("Process ID"); tcpTable.Columns.Add("Local Address"); tcpTable.Columns.Add("Remote Address"); tcpTable.Columns.Add("Local Port"); tcpTable.Columns.Add("Remote Port"); tcpTable.Columns.Add("Connection State"); TCPInfo.MIB_TCPROW_OWNER_PID[] tcpConnTable = TCPInfo.GetAllTcpConnections(); foreach (TCPInfo.MIB_TCPROW_OWNER_PID tcpRow in tcpConnTable) { tcpTable.Rows.Add(CreateRow(tcpRow)); } tcpGridView.DataSource = tcpTable; //refreshTimer.Enabled = true; }
private int GetNumTcpConns() { TCPInfo.MIB_TCPROW_OWNER_PID[] tcpConnTable = TCPInfo.GetAllTcpConnections(); return(tcpConnTable.Count()); }