怎样检测主机下的端口是否开放

怎样检测主机上的端口是否开放
我想写一个程序,隔一段时间去扫描一下几台主机的端口是否工作正常(比如80端口、1433端口等),不知用何控件比较简单实现。有源代码就更好啦
------解决方案--------------------
http://download.****.net/source/1625991

这里有个现成的 嘿嘿。
------解决方案--------------------
//---------------------------------------
#ifndef uGetAllListH
#define uGetAllListH

#include "iphlpapi.h"
#include "winsock.hpp"

#pragma link "C:\\Program Files\\Borland\\CBuilder6\\Lib\\Psdk\\iphlpapi.lib"

//---------------------------------------
String strTcpState[] =
{
    "未知状态", "已经关闭", "监听中", "同步发送",
    "同步接收", "已建立", "FIN_WAIT", "FIN_WAIT2",
    "等待关闭", "正在关闭", "LAST_ACK", "超时", "DELETE_TCB"
};
static PMIB_TCPTABLE pTcpTable;
static PMIB_UDPTABLE pUdpTable;
//---------------------------------------
// 解析IP,根据IP地址获取主机名称
String __fastcall GetHost(UINT unIpAddr)
{
    PHostEnt pHostEnt;
    TInAddr iaInAddr;
    String strRet;
    if(unIpAddr == 0)
        strRet = "0.0.0.0";
    else
    {
        Application->ProcessMessages();
        iaInAddr.S_un.S_addr = unIpAddr;
        strRet = strRet.sprintf("%d.%d.%d.%d",
                BYTE(iaInAddr.S_un.S_un_b.s_b1),
                BYTE(iaInAddr.S_un.S_un_b.s_b2),
                BYTE(iaInAddr.S_un.S_un_b.s_b3),
                BYTE(iaInAddr.S_un.S_un_b.s_b4));
    }
    return strRet;
}
//---------------------------------------
// 根据连接类型,获取端口的描述
String __fastcall GetPort(UINT unPort, char *pcProto)
{
    PServEnt pServEnt;
    Application->ProcessMessages();
    pServEnt = getservbyport(htons(unPort), pcProto);
    if(pServEnt != NULL)
        return String(unPort) + "(" + String(pServEnt->s_name) + ")";
    else
        return String(IntToStr(unPort));
};
//---------------------------------------
// 获取TCP链接的信息
void __fastcall MyGetTcpTable(TListView *lv)
{
    DWORD dwRetVal;
    DWORD dwLocalPort, dwLocalAddr, dwRemotePort, dwRemoteAddr;

    if(pTcpTable != NULL)
        GlobalFree(pTcpTable);
    pTcpTable = (MIB_TCPTABLE *)GlobalAlloc(GMEM_SHARE, sizeof(MIB_TCPTABLE));
    DWORD dwSize = 0;