Windows Sockets 1.1应用实例(141)

2010-12-30 20:58:11 · 作者: · 浏览: 62966
OCKET) -1;

    }

   

    SetDlgItemText(hOurDlg, IDD_COMMENT, "...Connected");

    return hSock;

}

 

 

SOCKET GetSocketAndBind(HWND hOurDlg, int iProto, int iSockPort)

{

    SOCKET hSock;                  /* Connection socket descriptor      */

    struct sockaddr_in local;              /* Local machine address structure*/

    int iSockType;

    extern int iTCP;

    extern int iUDP;

   

    /* Internet family addressing */

    if (iProto == iTCP) {

       iSockType = SOCK_STREAM;

    }

    else {

       iSoc