获取系统系统所有TCP以及UDP端口使用情况
来源:互联网 发布:乐视 大数据部高级总监 编辑:程序博客网 时间:2024/05/06 08:53
GetTcpTable
GetTcpTable
The GetTcpTable function retrieves the TCP connection table.
DWORD GetTcpTable( PMIB_TCPTABLE pTcpTable, // buffer for the connection table PDWORD pdwSize, // size of the buffer BOOL bOrder // sort the table?);
Parameters
- pTcpTable
- [out] Pointer to a buffer that receives the TCP connection table as a MIB_TCPTABLE structure.
- pdwSize
- [in, out] On input, specifies the size of the buffer pointed to by the pTcpTable parameter.
On output, if the buffer is not large enough to hold the returned connection table, the function sets this parameter equal to the required buffer size.
- bOrder
- [in] Specifies whether the connection table should be sorted. If this parameter is TRUE, the table is sorted in the order of:
- Local IP address
- Local port
- Remote IP address
- Remote port
Return Values
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Windows NT/2000 or later: Requires Windows NT 4.0 SP4 or later.
Windows 95/98/Me: Requires Windows 98 or later.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
MIB_TCPTABLE
MIB_TCPTABLE
The MIB_TCPTABLE structure contains a table of TCP connections.
typedef struct _MIB_TCPTABLE { DWORD dwNumEntries; // number of entries in the table MIB_TCPROW table[ANY_SIZE]; // array of TCP connections } MIB_TCPTABLE, *PMIB_TCPTABLE;
Members
- dwNumEntries
- Specifies the number of entries in the table.
- table[ANY_SIZE]
- Pointer to a table of TCP connections implemented as an array of MIB_TCPROW structures.
- MIB_TCPROW
MIB_TCPROW
The MIB_TCPROW structure contains information for a TCP connection.
typedef struct _MIB_TCPROW { DWORD dwState; // state of the connection DWORD dwLocalAddr; // address on local computer DWORD dwLocalPort; // port number on local computer DWORD dwRemoteAddr; // address on remote computer DWORD dwRemotePort; // port number on remote computer} MIB_TCPROW, *PMIB_TCPROW;
Members
- dwState
- Specifies the state of the TCP connection. This member can have one of the following values.
Value Description MIB_TCP_STATE_CLOSEDTo be determined. MIB_TCP_STATE_LISTENTo be determined. MIB_TCP_STATE_SYN_SENTTo be determined. MIB_TCP_STATE_SYN_RCVDTo be determined. MIB_TCP_STATE_ESTABTo be determined. MIB_TCP_STATE_FIN_WAIT1To be determined. MIB_TCP_STATE_FIN_WAIT2To be determined. MIB_TCP_STATE_CLOSE_WAITTo be determined. MIB_TCP_STATE_CLOSINGTo be determined. MIB_TCP_STATE_LAST_ACKTo be determined. MIB_TCP_STATE_TIME_WAITTo be determined. MIB_TCP_STATE_DELETE_TCBTransmission Control Block (TCB) deleted. - dwLocalAddr
- Specifies the address for the connection on the local computer.
- dwLocalPort
- Specifies the port number for the connection on the local computer.
- dwRemoteAddr
- Specifies the address for the connection on the remote computer.
- dwRemotePort
- Specifies the port number the connection on the remote computer.
GetUdpTable
GetUdpTable
The GetUdpTable function retrieves the User Datagram Protocol (UDP) listener table.
DWORD GetUdpTable( PMIB_UDPTABLE pUdpTable, // buffer for the listener table PDWORD pdwSize, // size of buffer BOOL bOrder // sort the table?);
Parameters
- pUdpTable
- [out] Pointer to a buffer that receives the UDP listener table as a MIB_UDPTABLE structure.
- pdwSize
- [in, out] On input, specifies the size of the buffer pointed to by the pUdpTable parameter.
On output, if the buffer is not large enough to hold the returned listener table, the function sets this parameter equal to the required buffer size.
- bOrder
- [in] Specifies whether the returned table should be sorted. If this parameter is TRUE, the table is sorted in the order of:
- IP address
- Port
Return Values
If the function succeeds, the return value is NO_ERROR.
If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Windows NT/2000 or later: Requires Windows NT 4.0 SP4 or later.
Windows 95/98/Me: Requires Windows 98 or later.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
MIB_UDPTABLE
MIB_UDPTABLE
The MIB_UDPTABLE structure contains a table of MIB_UDPROW structures.
typedef struct _MIB_UDPTABLE { DWORD dwNumEntries; // number of entries in the table MIB_UDPROW table[ANY_SIZE]; // table of MIB_UDPROW structs} MIB_UDPTABLE, *PMIB_UDPTABLE;
Members
- dwNumEntries
- Specifies the number of entries in the table.
- table[ANY_SIZE]
- Pointer to an array of MIB_UDPROW structures.
- MIB_UDPROW
MIB_UDPROW
The MIB_UDPROW structure contains address information for sending and receiving User Datagram Protocol (UDP) datagrams.
typedef struct _MIB_UDPROW { DWORD dwLocalAddr; // IP address on local computer DWORD dwLocalPort; // port number on local computer} MIB_UDPROW, *PMIB_UDPROW;
Members
- dwLocalAddr
- Specifies the IP address on the local computer.
- dwLocalPort
- Specifies the port number on the local computer.
- 获取系统系统所有TCP以及UDP端口使用情况
- 使用python获取系统所有进程PID以及进程名称
- 获取系统内存使用情况
- 显示系统端口使用情况 及 进程使用情况
- linux:获取系统内存使用情况
- 获取系统CPU及内存使用情况
- 查看系统端口占用情况
- 查看系统端口占用情况
- 查看系统端口占用情况
- 查看系统端口占用情况
- 获取系统空闲端口
- 获取当前系统所有使用的设备
- TCP和UDP端口号使用
- 获取系统所有进程
- linux 查看 系统 端口占用情况
- 简单的查看系统端口占用情况
- 精确查看端口占用情况-Windows系统
- linux系统下查看端口开放情况
- Exchange2003 + outlook2003 实现OWA
- javascript操作xml 1
- 下拉框模拟只读
- php中iconv函数使用方法
- asp.net 内嵌代码
- 获取系统系统所有TCP以及UDP端口使用情况
- javascript操作xml 2
- 搜索引擎之分词设计
- 提升JSP应用程序的七大绝招
- 谷歌在中央电视台做软广告了
- latex CJK 中文字体的显示问题
- 谁知道这是什么原因
- 爸爸的病情严重
- pushmail的YY