文件名称:获取TCP,UDP服务端口号.rar
文件大小:351KB
文件格式:RAR
更新时间:2023-01-31 10:27:00
TCP UDP服务端口
TCP,UDP服务端口,HMODULE hIpDLL = LoadLibrary( "iphlpapi.dll");
if ( !hIpDLL)
return;
PMIB_TCPTABLE_OWNER_PID pTcpTable(NULL);
DWORD dwSize(0);
PGet_Extended_TcpTable pGetExtendedTcpTable = NULL;
pGetExtendedTcpTable = (PGet_Extended_TcpTable) GetProcAddress(hIpDLL, "GetExtendedTcpTable");
if(pGetExtendedTcpTable==NULL)
{
FreeLibrary(hIpDLL);
return;
}
if(pGetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0) == ERROR_INSUFFICIENT_BUFFER)
pTcpTable = (MIB_TCPTABLE_OWNER_PID *)new char[dwSize];//重新分配缓冲区
if (pGetExtendedTcpTable(pTcpTable, &dwSize, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0) != NO_ERROR)
{
delete pTcpTable;
return;
}
CString sTemp;
m_PortList.DeleteAllItems();
int nNum = (int)pTcpTable->dwNumEntries; //TCP连接的数目
// nNum = 0;
for (int i = 0; i
【文件预览】:
ListPort
----psapi.lib(7KB)
----ListPort.dsw(539B)
----ListPort.ncb(81KB)
----resource.h(731B)
----ListPort.plg(250B)
----ListPort.cpp(2KB)
----Debug()
----BitMapMem.h(2KB)
----ListPort.opt(807KB)
----ListPort.aps(56KB)
----ListPortDlg.cpp(31KB)
----ListPortDlg.h(2KB)
----ReadMe.txt(4KB)
----Psapi.h(6KB)
----SimpleListCtrl.cpp(21KB)
----res()
--------ListPort.ico(21KB)
--------ListPort.rc2(400B)
--------greengrid.bmp(198B)
--------head.ico(1KB)
----ListPort.clw(774B)
----IPHLPAPI.LIB(83KB)
----IPEXPORT.H(9KB)
----ListPort.rc(5KB)
----ListPort.h(1KB)
----Release()
----ListCtrlHeader.h(2KB)
----IPTYPES.H(7KB)
----StdAfx.cpp(210B)
----Iphlpapi.h(16KB)
----ListPort.dsp(5KB)
----StdAfx.h(1KB)
----SimpleListCtrl.h(3KB)
----ListCtrlHeader.cpp(8KB)