Windows Sockets 1.1应用实例(138)

2010-12-30 20:58:11 · 作者: · 浏览: 62970
nbsp;  hostent FAR *host_ptr;         /* Ptr to the host name   */

    struct      sockaddr_in dest;          /* Addr of target host    */

    SOCKET hSock;                         /* The socket to create */

    int iSockType;

    extern int iTCP;

    extern int iUDP;

 

    /* Internet family addressing */

    dest.sin_family = PF_INET;

    if (iproto == iTCP) {

       iSockType = SOCK_STREAM;

    }

    else if (iproto == iUDP) {

       iSockType = SOCK_DGRAM;

    }

    else {

&nb