用GetTcpTable函数,可以得到已建立的连接的信息,就可以得到对端的ip地址和端口,就像netstat -n 一样。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