Welcome![Sign In][Sign Up]
Location:
Search - wsastartup

Search list

[TCP/IP stacktcp-ipayixidailv

Description: 一个简单的TCP客户端程序流程 1、使用WSAStartup()初始化WinSock库。 2、使用socket()创建一个IPPROTO_TCP SOCKET。 3、使用gethostbyname()/gethostbyaddr()获取主机信息。 4、使用connect()和我们创建的套接字连接服务器。 5、使用send()/recv()发送和接收数据,直到我们的TCP会话结束。 6、使用closesocket()关闭套接字连接。 7、使用WSACleanup()释放WinSock。 -a simple TCP client a process, the use of WSAStartup () initialization WinSock library. 2, the use of socket () to create a IPPROTO_TCP SOCKET. 3, the use of gethostbyname () / gethostbyaddr () mainframe access information. 4, the use of connect (), and we create the socket connections server. 5, the use of send () / recv () to send and receive data until we TCP end of the session. 6, the use of closesocket () closes socket connections. 7, the use of WSACleanup () release WinSock.
Platform: | Size: 5096 | Author: 顾谦 | Hits:

[WinSock-NDISVIPSHELL2007

Description: VipShellServer 是服务端程序。 VipShellServer.cpp 连接的地址在 void CVipShellServer::Test() { //.. WORD wVersionRequested = MAKEWORD(1, 1) WSADATA wsaData WSAStartup(wVersionRequested, &wsaData) // CreateThread(0,0,Thread,0,0,0) Start(\"127.0.0.1\", 99) }
Platform: | Size: 497385 | Author: coco | Hits:

[Button controlTrueColorToolBar

Description: 工具条此函数在应用程序中初始化Windows Sockets DLL ,只有此函数调用成功后,应用程序才可以再调用其他Windows Sockets DLL中的API函数。在程式中调用该函数的形式如下:WSAStartup((WORD)((1<<8 1),(LPWSADATA)&WSAData),其中(1<<8 1)表示我们用的是WinSocket1.1版本,WSAata用来存储系统传回的关于WinSocket的资料。-tools of this function in the application process DLL initialization Windows Sockets, only this function call is successful, the application can only call other Windows Sockets API DLL function. Calling the program in the form of this function is as follows : WSAStartup ((WORD) ((1LT; Lt; 8 1), (LPWSADATA) WSAData), (1LT; Lt; 8 1), we use the WinSocket1.1 version WSAata department store EC came back on Winsocket information.
Platform: | Size: 48216 | Author: 金鹰 | Hits:

[Internet-Network一个判断远程主机存活程序代码

Description: 一个判断远程主机存活程序代码(ping) #include #include #include #include #include "winsock.h" #pragma comment(lib,"Ws2_32"); #define SEND_SIZE 32 #define PACKET_SIZE 4096 #define ICMP_ECHO 8 #define ICMP_ECHOREPLY 0 struct icmp { unsigned char icmp_type; unsigned char icmp_code; unsigned short icmp_cksum; unsigned short icmp_id; unsigned short icmp_seq; unsigned long icmp_data; }; struct ip { unsigned char ip_hl:4; unsigned char ip_v:4; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_p; unsigned short ip_sum; unsigned long ip_src; unsigned long ip_dst; }; unsigned char sendpacket[PACKET_SIZE]; unsigned char recvpacket[PACKET_SIZE]; struct sockaddr_in dest_addr; struct sockaddr_in from_addr; int sockfd; int pid; unsigned short cal_chksum(unsigned short *addr,int len); int pack(int pack_no); int unpack(unsigned char *buf,int len); void send_packet(void); void recv_packet(void); void main(int argc,char *argv[]) { struct hostent *host; struct protoent *protocol; WSADATA wsaData; int timeout=1000; int SEND_COUNT=4; int i; char *par_host; par_host=argv[argc-1]; //IP赋值 switch(argc) { case 2: break; case 3: if(strcmp(argv[1],"-t")==0) { SEND_COUNT=10000; break; } //fall through default: printf("usage: %s [-t] Host name or IP address\n",argv[0]); exit(1); } if(WSAStartup(0x1010,&wsaData)!=0) { printf("wsastartup error\n"); exit(1); } if( (protocol=getprotobyname("icmp") )==NULL) { printf("getprotobyname error\n"); exit(1); } /* printf("%s\n",protocol->p_name); printf("%s\n",protocol->p_aliases); printf("%d\n",protocol->p_proto); system("pause"); */ if( (sockfd=socket(AF_INET,SOCK_RAW,protocol->p_proto) )<0) { printf("socket error\n"); exit(1); } if(setsockopt(sockfd,SOL_SOCKET,SO_RCVTIMEO,(char*)&timeout,sizeof(timeout))h_length); //resolve address to hostname if(host=gethostbyaddr(host->h_addr,4,PF_INET)) par_host=host->h_name; // //printf("%s\n",par_host); // } else if( dest_addr.sin_addr.s_addr=inet_addr(par_host)==INADDR_NONE) { printf("Unkown host %s\n",par_host); exit(1); } pid=getpid(); /* printf("%d\n",pid); system("pause"); */ printf("Pinging %s [%s]: with %d bytes of data:\n\n",par_host,inet_ntoa(dest_addr.sin_addr),SEND_SIZE); for(i=0;i1) { sum+=*w++; nleft-=2; } if( nleft==1) { *(unsigned char *)(&answer)=*(unsigned char *)w; sum+=answer; } sum=(sum>>16)+(sum&0xffff); sum+=(sum>>16); answer=~sum; return answer; } //打包 int pack(int pack_no) { int packsize; struct icmp *icmp; packsize=8+SEND_SIZE; icmp=(struct icmp*)sendpacket; icmp->icmp_type=ICMP_ECHO; icmp->icmp_code=0; icmp->icmp_cksum=0; icmp->icmp_seq=pack_no; icmp->icmp_id=pid; icmp->icmp_data=GetTickCount(); icmp->icmp_cksum=cal_chksum( (unsigned short *)icmp,packsize); /*校验算法*/ return packsize; } //解包 int unpack(unsigned char *buf,int len) { struct ip *ip; struct icmp *icmp; double rtt; int iphdrlen; ip=(struct ip *)buf; iphdrlen=ip->ip_hl*4; icmp=(struct icmp *)(buf+iphdrlen); if( (icmp->icmp_type==ICMP_ECHOREPLY) && (icmp->icmp_id==pid) ) { len=len-iphdrlen-8; rtt=GetTickCount()-icmp->icmp_data; printf("Reply from %s: bytes=%d time=%.0fms TTL=%d icmp_seq=%u\n", inet_ntoa(from_addr.sin_addr), len, rtt, ip->ip_ttl, icmp->icmp_seq); return 1; } return 0; } //发送 void send_packet() { int packetsize; static int pack_no=0; packetsize=pack(pack_no++); if( sendto(sockfd,(char *)sendpacket,packetsize,0,(struct sockaddr *)&dest_addr,sizeof(dest_addr) )=0) success=unpack(recvpacket,n); else if (WSAGetLastError() == WSAETIMEDOUT) { printf("Request timed out.\n"); return; } }while(!success); } UID5380 帖子239 精华0 积分1289 阅读权限40 来自软件学院 在线时间81 小时 注册时间2006-5-22 最后登录2007-2-24 查看详细资料 TOP
Platform: | Size: 5881 | Author: shuiyuan313 | Hits:

[Button controlTrueColorToolBar

Description: 工具条此函数在应用程序中初始化Windows Sockets DLL ,只有此函数调用成功后,应用程序才可以再调用其他Windows Sockets DLL中的API函数。在程式中调用该函数的形式如下:WSAStartup((WORD)((1<<8 1),(LPWSADATA)&WSAData),其中(1<<8 1)表示我们用的是WinSocket1.1版本,WSAata用来存储系统传回的关于WinSocket的资料。-tools of this function in the application process DLL initialization Windows Sockets, only this function call is successful, the application can only call other Windows Sockets API DLL function. Calling the program in the form of this function is as follows : WSAStartup ((WORD) ((1LT; Lt; 8 1), (LPWSADATA) WSAData), (1LT; Lt; 8 1), we use the WinSocket1.1 version WSAata department store EC came back on Winsocket information.
Platform: | Size: 48128 | Author: 金鹰 | Hits:

[TCP/IP stacktcp-ipayixidailv

Description: 一个简单的TCP客户端程序流程 1、使用WSAStartup()初始化WinSock库。 2、使用socket()创建一个IPPROTO_TCP SOCKET。 3、使用gethostbyname()/gethostbyaddr()获取主机信息。 4、使用connect()和我们创建的套接字连接服务器。 5、使用send()/recv()发送和接收数据,直到我们的TCP会话结束。 6、使用closesocket()关闭套接字连接。 7、使用WSACleanup()释放WinSock。 -a simple TCP client a process, the use of WSAStartup () initialization WinSock library. 2, the use of socket () to create a IPPROTO_TCP SOCKET. 3, the use of gethostbyname ()/gethostbyaddr () mainframe access information. 4, the use of connect (), and we create the socket connections server. 5, the use of send ()/recv () to send and receive data until we TCP end of the session. 6, the use of closesocket () closes socket connections. 7, the use of WSACleanup () release WinSock.
Platform: | Size: 5120 | Author: 顾谦 | Hits:

[Internet-NetworkVIPSHELL2007

Description: VipShellServer 是服务端程序。 VipShellServer.cpp 连接的地址在 void CVipShellServer::Test() { //.. WORD wVersionRequested = MAKEWORD(1, 1) WSADATA wsaData WSAStartup(wVersionRequested, &wsaData) // CreateThread(0,0,Thread,0,0,0) Start("127.0.0.1", 99) }-VipShellServer client service procedures. Address VipShellServer.cpp connected in void CVipShellServer:: Test () (//.. WORD wVersionRequested = MAKEWORD (1, 1) WSADATA wsaData WSAStartup (wVersionRequested,
Platform: | Size: 497664 | Author: coco | Hits:

[Windows Develop0600

Description: 线程的同步和异步一个简单的例子 WORD wVersionRequested WSADATA wsadata int err wVersionRequested=MAKEWORD(1,1) err=WSAStartup(wVersionRequested,&wsadata) -Synchronous and asynchronous threaded a simple example WORD wVersionRequested WSADATA wsadata int err wVersionRequested = MAKEWORD (1,1) err = WSAStartup (wVersionRequested,
Platform: | Size: 3680256 | Author: lumingyu | Hits:

[TCP/IP stackwinsock

Description: winsocket //--- --- ----- // Initialize Winsock WSAStartup(MAKEWORD(2,2), &wsaData) //----------------------------------------------- // Create a receiver socket to receive datagrams RecvSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) -winsocket //-----------------// Initialize Winsock WSAStartup (MAKEWORD (2,2),
Platform: | Size: 1024 | Author: czs | Hits:

[Shell apiVIPSHELL2007

Description: [VC] VIPSHELL2007代码 VipShellServer 是服务端程序。 VipShellServer.cpp 连接的地址在 void CVipShellServer::Test() { //.. WORD wVersionRequested = MAKEWORD(1, 1) WSADATA wsaData WSAStartup(wVersionRequested, &wsaData) // CreateThread(0,0,Thread,0,0,0) Start("127.0.0.1", 99) } 修改 同时对应的 VipShellClient m_spVipShellHandleServer->Listen(99, this) 也要修改-[VC] VIPSHELL2007 code VipShellServer client service procedures. Address VipShellServer.cpp connected in void CVipShellServer:: Test () (//.. WORD wVersionRequested = MAKEWORD (1, 1) WSADATA wsaData WSAStartup (wVersionRequested,
Platform: | Size: 606208 | Author: 精灵 | Hits:

[CommunicationWSAStartup

Description: socket communication
Platform: | Size: 12288 | Author: tugari | Hits:

[VC/MFCWinsockFunction

Description: WinSock基本函数的用法介绍,WSAStartup(),accept(),socket()等等函数。-The basic function of the use of WinSock description, WSAStartup (), accept (), socket (), etc. functions.
Platform: | Size: 8192 | Author: 高锋 | Hits:

[Internet-NetworkWindowsSocket

Description: Windows下的Socket程序设计 在Windows下实现Socket网络程序需要使用Winsock网络编程接口,应用程序通过调用Winsock的API实现相互间的通信。Winsock的服务是以动态链接库Winsock DLL形式实现的,所以必须先调用WSAStartup函数对Winsock进行初始化,协商Winsock的版本支持,分配必要的资源。 -Under Windows Socket Programming in Windows Socket network program needs to be achieved using Winsock network programming interfaces, an application by calling the Winsock API to achieve inter-communication. Winsock dynamic link library service is implemented as Winsock DLL, so you must first call the WSAStartup function to initialize Winsock, Winsock version negotiation support, allocation of necessary resources.
Platform: | Size: 7168 | Author: 和牧 | Hits:

[CommunicationUDP.rar

Description: 1、首先需要定义的对象: SOCKET ReceivingSocket //接收端的Socket SOCKADDR_IN ReceiverAddr //接收端的地址信息 char ReceiveBuf[1024] //接收数据缓冲区大小 int BufLength //缓冲区长度 SOCKADDR_IN SenderAddr //发送数据端地址信息 int SenderAddrSize = sizeof(SenderAddr) //发送端地址信息的长度 2、启动WSA动态库: WSAStartup(MAKEWORD(2,2),&wsd) 3、创建socket: ReceivingSocket=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP) 4、初始化服务器地址及监听端口 ReceiverAddr.sin_family=AF_INET //家族 ReceiverAddr.sin_port=htons(9000) //设置端口号 ReceiverAddr.sin_addr.s_addr=htonl(INADDR_ANY) //地址 5、绑定端口 6、接收数据: ReceivingSocket,//接收端Socket ReceiveBuf,//接收端用来存储数据的缓冲区 BufLength,//缓冲区的大小 0,//接收的附加选项,设置为0即可 (SOCKADDR*)&SenderAddr,//发送端的Socket地址 &SenderAddrSize//发送端Socket地址的大小 ) 7、关闭socket,关闭WSA,1, you first need to define the object: the SOCKET ReceivingSocket // the the receiving end Socket SOCKADDR_IN distant ReceiverAddr // the receiving end the address information char ReceiveBuf of [1024] /​ ​ / receive data buffer size int BufLength // buffer length SOCKADDR_IN distant SenderAddr // send data end address information int SenderAddrSize = sizeof (SenderAddr) // length of the address information of the sender, start WSA dynamic library: the WSAStartup (MAKEWORD (2,2), & wsd) 3, create socket: ReceivingSocket = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP) initialize server address and listen port ReceiverAddr.sin_family = AF_INET //family ReceiverAddr.sin_port = htons (9000) //set port number ReceiverAddr.sin_addr.s_addr = htonl (INADDR_ANY) //address 5, binding port 6 the the receiver Data: ReceivingSocket,// ​ ​ receiving end the the Socket ReceiveBuf,// ​ ​ receiving end is used to store data buffer BufLength// buffer size 0,// ​
Platform: | Size: 5223424 | Author: xiaoxiao | Hits:

[Internet-NetworkWSAStartup

Description: 书上的socket编程的初始化,我试过了,请放心使用-Initialization of socket programming book, I tried, please feel free to use
Platform: | Size: 1179648 | Author: ww | Hits:

[ADO-ODBCSOCKET.CPP

Description: #include <winsock2.h> #pragma comment(lib, ws2_32.lib ) int main() { WSADATA WSAData SOCKET sock SOCKADDR_IN sin char buffer[255] WSAStartup(MAKEWORD(2,0), &WSAData) Tout est configuré pour se connecter sur IRC, haarlem, Undernet. sock = socket(AF_INET, SOCK_STREAM, 0) sin.sin_addr.s_addr = inet_addr( 62.250.14.6 ) sin.sin_family = AF_INET sin.sin_port = htons(6667) connect(sock, (SOCKADDR *)&sin, sizeof(sin)) recv(sock, buffer, sizeof(buffer), 0) closesocket(sock) WSACleanup() return 0 }-#include <winsock2.h> #pragma comment(lib, ws2_32.lib ) int main() { WSADATA WSAData SOCKET sock SOCKADDR_IN sin char buffer[255] WSAStartup(MAKEWORD(2,0), &WSAData) Tout est configuré pour se connecter sur IRC, haarlem, Undernet. sock = socket(AF_INET, SOCK_STREAM, 0) sin.sin_addr.s_addr = inet_addr( 62.250.14.6 ) sin.sin_family = AF_INET sin.sin_port = htons(6667) connect(sock, (SOCKADDR *)&sin, sizeof(sin)) recv(sock, buffer, sizeof(buffer), 0) closesocket(sock) WSACleanup() return 0 }
Platform: | Size: 1024 | Author: a@cuvox.de | Hits:

[Dialog_Windowysing

Description: 一个简单的TCP客户端程序流程 1,使用WSAStartup()初始化WinSock库-A simple TCP client program flow 1, using WSAStartup () to initialize WinSock library
Platform: | Size: 5120 | Author: OR!238878 | Hits:

[Mathimatics-Numerical algorithmscuhttructorsyntax

Description: A simple TCP client program flow 1, using WSAStartup () to initialize WinSock library
Platform: | Size: 5120 | Author: databares | Hits:

[Dialog_Windowhpbfhy

Description: 一个简单的TCP客户端程序流程 1,使用WSAStartup()初始化WinSock库-A simple TCP client program flow 1, using WSAStartup () to initialize WinSock library
Platform: | Size: 5120 | Author: zptikn | Hits:

[OS program18033078

Description: 一个简单的TCP客户端程序流程 1,使用WSAStartup()初始化WinSock库(A simple TCP client program flow 1, using WSAStartup () to initialize WinSock library)
Platform: | Size: 4096 | Author: ranvkm | Hits:
« 12 »

CodeBus www.codebus.net