当前位置:首页 > 儿童诗歌 > 文章

Socket编程指南及示例程序

日期:2019-08-13?|? 作者:本站原创?|? 168 人围观!

	Socket编程指南及示例程序

D:"Code""Socket"socket_srcUDP_Send_::::anUDPpackageissended.^_int;typedefu_intSOCKET;;SocketMAKEWORDWORD20WORDwVersionRequested;wVersionRequested=MAKEWORD(2,0);{WORDwVersion;WORDwHighVersion;charszDescription[WSADESCRIPTION_LEN+1];charszSystemStatus[WSASYS_STATUS_LEN+1];unsignedshortiMaxSockets;unsignedshortiMaxUdpDg;charFAR*lpVendorInfo;}WSADATA;typedefWSADATAFAR*LPWSADATA;(WORDwVersionRequired,LPWSADATAlpWSAData);PASCALPASCAL___(intaf,inttype,intprotocol);intafAF_INETinternetinttypeSOCK_DGRAMUDPSOCK_STREAMTCPintprotocol0SOCKETINVALID_(SOCKETs,intlevel,intoptname,constcharFAR*optval,intoptlen);int0SOCKET_ERRORSOCKETsintlevelSOL_SOCKETIPPROTO_TCPTCPIPPROTO_IPIPintoptnameSO_BROADCASTMSDNconstcharFAR*optvalreinterpret__inin_addrinet_addrinet_ntoasockaddr_insocketstructsockaddr_in{shortsin_family;u_shortsin_port;structin_addrsin_addr;charsin_zero[8];};in_addrstructin_addr{union{struct{u_chars_b1,s_b2,s_b3,s_b4;}S_un_b;struct{u_shorts_w1,s_w2;}S_un_w;u_longS_addr;}S_un;in_addripunionc++IPIPIPin_addrinet_addrIPin___addr=inet_addr("");inet_ntoain_addrsockaddr_inin_addrshortsin_familyAF_INETu_shortsin_portIPstructin_addrsin_addrIPcharsin_zero[8]sockaddr_inSOCKADDR7861sockaddr_inaddrto;//memset(addrto,0,sizeof(addrto));_family=AF_INET;//__addr=INADDR_BROADCAST;//_port=htons(7861);//_insockaddrsockaddr_inTCP/IPSockaddrstructsockaddr{u_shortsa_family;charsa_data[14];};sockaddr16sockaddr_in16sockaddr_(1000)(SOCKETs,constcharFAR*buf,intlen,intflags,conststructsockaddrFAR*to,inttolen);。


现代文学提供的文章均由网友转载于网络,若本站转载中的文章侵犯了您的权益,请与本站管理员联系. Copyright © 2006-2019 www.hf0666.com现代文学-文学期刊 All Rights Reserved.

返回顶部