获取系统系统所有TCP以及UDP端口使用情况
2009-06-19 12:50
579 查看
GetTcpTable
The GetTcpTable
function retrieves the TCP connection table.
[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
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
The MIB_TCPTABLE
structure contains a table of TCP connections.
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
The MIB_TCPROW
structure contains information for a TCP
connection.
Specifies the state of the TCP connection. This member can have one of the
following values.
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
The GetUdpTable
function retrieves the User Datagram Protocol (UDP)
listener table.
[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
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
The MIB_UDPTABLE
structure contains a table of MIB_UDPROW
structures.
Specifies the number of entries in the table.
table[ANY_SIZE]
Pointer to an array of MIB_UDPROW
structures.
MIB_UDPROW
The MIB_UDPROW
structure contains address information for sending and
receiving User Datagram Protocol (UDP) datagrams.
Specifies the IP address on the local computer.
dwLocalPort
Specifies the port number on the local computer.
GetTcpTable
The GetTcpTablefunction 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_TCPTABLEstructure 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
dwNumEntriesSpecifies 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_TCPROWstructure 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
dwStateSpecifies the state of the TCP connection. This member can have one of the
following values.
Value | Description |
---|---|
MIB_TCP_STATE_CLOSED | To be determined. |
MIB_TCP_STATE_LISTEN | To be determined. |
MIB_TCP_STATE_SYN_SENT | To be determined. |
MIB_TCP_STATE_SYN_RCVD | To be determined. |
MIB_TCP_STATE_ESTAB | To be determined. |
MIB_TCP_STATE_FIN_WAIT1 | To be determined. |
MIB_TCP_STATE_FIN_WAIT2 | To be determined. |
MIB_TCP_STATE_CLOSE_WAIT | To be determined. |
MIB_TCP_STATE_CLOSING | To be determined. |
MIB_TCP_STATE_LAST_ACK | To be determined. |
MIB_TCP_STATE_TIME_WAIT | To be determined. |
MIB_TCP_STATE_DELETE_TCB | Transmission Control Block (TCB) deleted. |
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 GetUdpTablefunction 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_UDPTABLEstructure 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
dwNumEntriesSpecifies the number of entries in the table.
table[ANY_SIZE]
Pointer to an array of MIB_UDPROW
structures.
MIB_UDPROW
MIB_UDPROW
The MIB_UDPROWstructure 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
dwLocalAddrSpecifies the IP address on the local computer.
dwLocalPort
Specifies the port number on the local computer.
相关文章推荐
- 获取系统当前打开的端口(tcp。udp)状态,以及连接方的ip。端口
- python打印系统所有tcp,udp监听端口及服务
- 使用python获取系统所有进程PID以及进程名称
- 超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
- 获取Android系统所有内置SD卡以及外置SD卡路径
- Android中获取系统内存信息以及进程信息-----ActivityManager的使用(一)
- 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
- “超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。”问题的解决方法
- 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
- 获取系统CPU及内存使用情况
- System.InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
- 如何使用Hpple解析HTML,以及获取网站上的所有超链接
- netstat -anp 显示系统端口使用情况
- Android中获取系统内存信息以及进程信息-----ActivityManager的使用(一)
- [转]排查线程池使用情况,可定时任务统计.打印到指定日志. 获取系统扩容,线程池改造信息.
- 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
- Android中获取系统内存信息以及进程信息-----ActivityManager的使用
- Atitit. 数据库-----catalog与schema的设计区别以及在实际中使用 获取数据库所有库表 java jdbc php c#.Net
- 超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第四节 获取当前TCP连接情况