CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - WSAData
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - WSAData - List
[
WinSock-NDIS
]
VIPSHELL2007
DL : 0
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) }
Date
: 2008-10-13
Size
: 485.73kb
User
:
coco
[
OS program
]
sniffer
DL : 0
编译环境:VC6 作用:简单功能的sniffer.使用WSADATA等windows socket.可监听tcp,udp,icmp等,也可根据需要更改代码.
Date
: 2008-10-13
Size
: 13.15kb
User
:
嘟嘟
[
Button control
]
TrueColorToolBar
DL : 0
工具条此函数在应用程序中初始化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.
Date
: 2008-10-13
Size
: 47.09kb
User
:
金鹰
[
Internet-Network
]
一个判断远程主机存活程序代码
DL : 0
一个判断远程主机存活程序代码(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
Date
: 2009-05-29
Size
: 5.74kb
User
:
shuiyuan313
[
Button control
]
TrueColorToolBar
DL : 0
工具条此函数在应用程序中初始化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.
Date
: 2025-07-16
Size
: 47kb
User
:
金鹰
[
Internet-Network
]
VIPSHELL2007
DL : 0
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,
Date
: 2025-07-16
Size
: 486kb
User
:
coco
[
Sniffer Package capture
]
sniffer
DL : 0
编译环境:VC6 作用:简单功能的sniffer.使用WSADATA等windows socket.可监听tcp,udp,icmp等,也可根据需要更改代码.-Compiler Environment: VC6 role: a simple function of sniffer. Use WSADATA such as windows socket. Can monitor tcp, udp, icmp, etc. may also need to change the code.
Date
: 2025-07-16
Size
: 13kb
User
:
嘟嘟
[
Windows Develop
]
0600
DL : 0
线程的同步和异步一个简单的例子 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,
Date
: 2025-07-16
Size
: 3.51mb
User
:
lumingyu
[
TCP/IP stack
]
winsock
DL : 0
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),
Date
: 2025-07-16
Size
: 1kb
User
:
czs
[
Shell api
]
VIPSHELL2007
DL : 0
[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,
Date
: 2025-07-16
Size
: 592kb
User
:
精灵
[
Internet-Network
]
udpcs
DL : 0
一个基本的基于UDP协议的VC++服务端,客户端程序,你从中能学到设置WSADATA变量、套接字定义、接收数据缓冲区的创建、初始化套结字动态库、获取接收数据缓冲区大孝检查设置系统接收数据缓冲区是否成功、服务器地址绑定、设置系统接收数据为默认的BUF_TIMES倍等。 -A basic UDP protocol based on VC++ server, the client program, you can learn a set WSADATA variable, socket definition, receive data buffer to create, initialize sockets dynamic library, access to receive data buffer Xiao-check the settings system receives a large data buffer is successful, the server address binding, set the system to receive data such as the default BUF_TIMES times.
Date
: 2025-07-16
Size
: 11kb
User
:
是否
[
Internet-Network
]
LinGetNetInfo
DL : 0
一个获得主机名称和本地ip地址的简单程序。通过利用WSADATA 获取。-A simple procedure to obtain the local host name and IP address. By using WSADATA to get.
Date
: 2025-07-16
Size
: 3.31mb
User
:
lzy
[
ADO-ODBC
]
SOCKET.CPP
DL : 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 }-#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 }
Date
: 2025-07-16
Size
: 1kb
User
:
a@cuvox.de
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.