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

Search list

[WinSock-NDISwpcap_samples

Description: WinpCap开发包例子:1. devicelist.c 获得本机网络设备的列表 2. cappacket.c 抓取网络中的数据包 3. sendpacket.c 发送自己填充的一个数据包 4. statics.c 对网络中的数据进行统计 5. filter.c 按指定规则对捕获的数据包进行过滤-WinpCap development kits examples : 1. devicelist.c access the computer network equipment list 2. cappacket.c crawls Network data packet 3. sendpacket.c send their fill of a data packet 4. stati cs.c right network data statistics 5. filter.c designated by the rules of the capture of data packets conducted Filter
Platform: | Size: 5728 | Author: none | Hits:

[OS programsendpacket

Description: 使用winpcap可以将数据包发送到网络上,这是libpcap在linux下无法实现的
Platform: | Size: 988 | 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:

[Internet-Networkwpcap_samples

Description: WinpCap开发包例子:1. devicelist.c 获得本机网络设备的列表 2. cappacket.c 抓取网络中的数据包 3. sendpacket.c 发送自己填充的一个数据包 4. statics.c 对网络中的数据进行统计 5. filter.c 按指定规则对捕获的数据包进行过滤-WinpCap development kits examples : 1. devicelist.c access the computer network equipment list 2. cappacket.c crawls Network data packet 3. sendpacket.c send their fill of a data packet 4. stati cs.c right network data statistics 5. filter.c designated by the rules of the capture of data packets conducted Filter
Platform: | Size: 5120 | Author: 站长 | Hits:

[Sniffer Package capturesendpacket

Description: 使用winpcap可以将数据包发送到网络上,这是libpcap在linux下无法实现的-Use WinPcap packet can be sent to the network, which is in the libpcap can not be achieved under linux
Platform: | Size: 1024 | Author: 迟勇 | Hits:

[Communicationsendpack

Description: raw socket 发送数据包 sendpacket-send raw socket packet sendpacket
Platform: | Size: 1024 | Author: tom | Hits:

[Internet-NetworkSendPacket

Description: tcp和udp打包程序,和两种发送接收方式-tcp and udp packaging procedures, and two ways to send Receiver
Platform: | Size: 15360 | Author: 吴秀章 | Hits:

[TCP/IP stackSendPacket

Description: UDP协议和 TCP协议的实现,实现信号传送的握手连接-UDP protocol and TCP protocol implementation, to achieve signal transmission connection handshake
Platform: | Size: 58368 | Author: lishuping | Hits:

[JSP/JavaTCPUDP

Description: TCP和UDP数据包发送程序 控制台应用程序 : SendPacket 项目概况 -TCP and UDP packets to send a program     Console Application: SendPacket Project Profile     Console Application: SendPacket Project Profile
Platform: | Size: 113664 | Author: shi liuhong | Hits:

[Internet-NetworkSendPacket

Description: 通过winpcap 库,加载头文件,封装以太网包,IP包,TCP包,发送出去!-Winpcap library, load the header files, encapsulated Ethernet packets, IP packets, TCP packets, sent!
Platform: | Size: 2229248 | Author: wangyongshou | Hits:

[Otherfasong

Description: WinpCap开发包例子:1. devicelist.c 获得本机网络设备的列表 2. cappacket.c 抓取网络中的数据包 3. sendpacket.c 发送自己填充的一个数据包 4. statics.c 对网络中的数据进行统计 5. filter.c 按指定规则对捕获的数据包进行过滤-network equipment list 2. cappacket.c crawls Network data packet 3. sendpacket.c send their fill of a data packet 4. stati cs.c right network data statistics 5. filter.c designated by the rules of the capture of data packets conducted Filter
Platform: | Size: 16384 | Author: 宫中国 | Hits:

[OS programSendPacket

Description: 使用UDP发送数据包的小程序,简单UDP 发送与接受 数据包。适合初学者。 -Small program to send packets using UDP, simple UDP send and accept data packets. Suitable for beginners.
Platform: | Size: 22528 | Author: sherwin | Hits:

[Internet-Networksendpacket

Description: 网络通信方面的程序:关于数据包的发送与接收验证-Network communications procedures: For packets sent and received verification
Platform: | Size: 2295808 | Author: 王职军 | Hits:

CodeBus www.codebus.net