贴吧用户_007ePbC🐾 -
关注数: 0 粉丝数: 22 发帖数: 8,752 关注贴吧数: 7
7 #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/ip_icmp.h> /* * */ unsigned short check_sum(unsigned short *buffer, int size) { unsigned long cksum = 0; while(size>1) { cksum += *buffer++; size -= sizeof(unsigned short); } if(size) { cksum += *(unsigned char*)buffer; } cksum = (cksum>>16) + (cksum&0xffff); cksum += (cksum>>16); return (unsigned short)(~cksum); } int main(int argc, char** argv) {      int fd = socket(AF_INET,SOCK_RAW,IPPROTO_ICMP);      if(fd   == -1)      {          perror("");          return -1;      }      struct icmp imp;      bzero(&imp,sizeof(imp));      imp.icmp_type = ICMP_ECHO;      imp.icmp_code = 0;      imp.icmp_id = getpid();      imp.icmp_seq = 0;      imp.icmp_cksum = 0;//check_sum(&imp,sizeof(imp));      //      struct sockaddr_in sock;      bzero(&sock,sizeof(sock));      sock.sin_family = AF_INET;      sock.sin_addr.s_addr = inet_addr("192.168.1.102");      int size = sendto(fd,&imp,sizeof(imp),0,&sock,sizeof(sock));      if(size == -1)      {          perror("sendto");           return -1;             }      //      char buffer[1024];      int len = sizeof(sock);     size =   recvfrom(fd,buffer,1024,0,&sock,&len);      if(size == -1)      {          perror("recvfrom");           return -1;             }     //     struct ip* p = buffer;      struct icmp* temp = (struct icmp*)(buffer+20);      printf("%d\n",temp->icmp_type);      printf("%d\n",temp->icmp_code);      //      return (EXIT_SUCCESS); } /* * File:    main.c * Author: root * * Created on December 2, 2009, 8:14 PM */ #include <stdio.h> #include <stdlib.h> #include <strings.h> #include <string.h> #include <sys/types.h>
6 Server: #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <netdb.h> #include <signal.h> #include <fcntl.h> int fd; struct sockaddr_in client; void hendle() {      int len;      len=sizeof(client);      char buffer[1024];      bzero(buffer,1024);      recvfrom(fd,buffer,1024,0,&client,&len);      printf("%s\n",buffer);      }      void main()      {          struct sockaddr_in server;          bzero(&server,sizeof(server));          fd=socket(AF_INET,SOCK_DGRAM,0);          server.sin_family=AF_INET;          server.sin_port=htons(1234);          server.sin_addr.s_addr=htonl(INADDR_ANY);          bind(fd,(struct sockaddr*)&server,sizeof(server));          fcntl(fd,F_SETOWN,getpid());          int flags=fcntl(fd,F_GETFL,0);          fcntl(fd,F_SETFL,flags|O_ASYNC);          signal(SIGIO,hendle);          while(1)          {              char buffer1[1024];              bzero(buffer1,1024);              scanf("%s",buffer1);              sendto(fd,buffer1,strlen(buffer1),0,&client,sizeof(client)); } } Client: #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <netdb.h> #include <signal.h> #include <fcntl.h> int fd; struct sockaddr_in server; void hendle() {      int len;      len=sizeof(server);      char buffer[1024];      bzero(buffer,1024);      recvfrom(fd,buffer,1024,0,&server,&len);      printf("%s\n",buffer);      }      void main()      {          bzero(&server,sizeof(server));          fd=socket(AF_INET,SOCK_DGRAM,0);          server.sin_family=AF_INET;          server.sin_port=htons(1234);          server.sin_addr.s_addr=inet_addr("127.0.0.1");          bind(fd,(struct sockaddr*)&server,sizeof(server));          fcntl(fd,F_SETOWN,getpid());          int flags=fcntl(fd,F_GETFL,0);          fcntl(fd,F_SETFL,flags|O_ASYNC);          signal(SIGIO,hendle);          while(1)          {              char buffer1[1024];              bzero(buffer1,1024);              scanf("%s",buffer1);              sendto(fd,buffer1,strlen(buffer1),0,&server,sizeof(server));    } }
4 #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/epoll.h> int main() {      int fd;      struct sockaddr_in server;      struct sockaddr_in client;      bzero(&server,sizeof(server));      fd=socket(AF_INET,SOCK_DGRAM,0);      server.sin_family=AF_INET;      server.sin_port=htons(1234);      server.sin_addr.s_addr=htonl(INADDR_ANY);      bind(fd,(struct sockaddr *)&server,sizeof(server));      client.sin_family=AF_INET;      client.sin_port=htons(1234);      client.sin_addr.s_addr=inet_addr("127.0.0.255");      int on=1;      setsockopt(fd,SOL_SOCKET,SO_BROADCAST,&on,sizeof(on));      int re_id=epoll_create(256);    struct epoll_event ev1;      ev1.data.fd=0;      ev1.events=EPOLLIN;      epoll_ctl(re_id,EPOLL_CTL_ADD,0,&ev1);      struct epoll_event ev2;      ev2.data.fd=fd;      ev2.events=EPOLLIN;      epoll_ctl(re_id,EPOLL_CTL_ADD,fd,&ev2);      while(1)      {          struct epoll_event ev3[256];          int ev3_count=epoll_wait(re_id,ev3,256,-1);          int i;          for(i=0;i<ev3_count;i++)          {              if(ev3[i].data.fd==0)              {              char buffer[1024];              bzero(buffer,1024);              scanf("%s",buffer);              sendto(fd,buffer,strlen(buffer),0,&client,sizeof(client));                  }               if(ev3[i].data.fd==fd)               {                    int len;                   len=sizeof(client);                   char buffer1[1024];                   bzero (buffer1,1024);                   recvfrom(fd,buffer1,1024,0,&client,&len);                   printf("%s\n",buffer1);                   }              }          }      }
3 服务器: #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> struct sockaddr_in client; void*rec(void*Lelman) {      while(1)      {      socklen_t len;       len=sizeof(client);       char buffer1[1024];       bzero(buffer1,1024);       recvfrom(Lelman,buffer1,1024,0,&client,&len);       printf("%s\n",buffer1);       }          } void*sen(void*Julyn) {      while(1)      {          char buffer2[1024];          bzero(buffer2,1024);          scanf("%s",buffer2);          sendto(Julyn,buffer2,strlen(buffer2),0,&client,sizeof(client));    } } int main() { int sockfd; struct sockaddr_in server; bzero(&server,sizeof(server)); sockfd=socket(AF_INET,SOCK_DGRAM,0); server.sin_family=AF_INET; server.sin_port=htons(1234); server.sin_addr.s_addr=htonl(INADDR_ANY); bind(sockfd,(struct sockaddr *)&server,sizeof(server)); int rec_id,sen_id; pthread_create(&rec_id,0,rec,sockfd); pthread_create(&sen_id,0,sen,sockfd); while(1) {      sleep(1); } } 客户端: #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> struct sockaddr_in server; void*rec(void*Lelman) {    while(1)    {     char buffer1[1024];     bzero(buffer1,1024);     recvfrom(Lelman,buffer1,1024,0,&server,sizeof(server));     printf("%s\n",buffer1);    } } void*sen(void*Julyn)      {          while(1)      {          char buffer2[1024];          bzero(buffer2,1024);          scanf("%s",buffer2);          sendto(Julyn,buffer2,strlen(buffer2),0,&server,sizeof(server));      }      }      int main()      {          int sockfd;          bzero(&server,sizeof(server));          sockfd=socket(AF_INET,SOCK_DGRAM,0);          server.sin_family=AF_INET;          server.sin_port=htons(1234);          server.sin_addr.s_addr=inet_addr("127.0.0.1");          int rec_id,sen_id;          pthread_create(&rec_id,0,rec,sockfd);          pthread_create(&sen_id,0,sen,sockfd);          while(1)          {              sleep(1);              }          }
2 服务端 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include<netinet/in.h> int main() {     int sockfd;     struct sockaddr_in server;     struct sockaddr_in client;     bzero(&server,sizeof(server));     sockfd=socket(AF_INET,SOCK_DGRAM,0);     server.sin_family=AF_INET;     server.sin_port=htons(1234);     server.sin_addr.s_addr=htonl(INADDR_ANY);     bind(sockfd,(struct sockaddr *)&server,sizeof(server));     socklen_t len;     char buffer1[1024];     char buffer2[1024];     while(1)     {         len=sizeof(client);     bzero(buffer1,1024);     bzero(buffer2,1024);     recvfrom(sockfd,buffer1,1024,0,&client,&len);     printf("%s\n",buffer1);     scanf("%s",buffer2);     sendto(sockfd,buffer2,strlen(buffer2),0,&client,len);     } } 客户端 #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <unistd.h> #include <netdb.h> int main() {      int sockfd;      struct sockaddr_in server;      sockfd=socket(AF_INET,SOCK_DGRAM,0);      bzero(&server,sizeof(server));      server.sin_family=AF_INET;      server.sin_port=htons(1234);      server.sin_addr.s_addr=inet_addr("127.0.0.1");       socklen_t len;       char buf1[1024];       char buf2[1024];       while(1) {    len=sizeof(server);    bzero(buf1,1024);        bzero(buf2,1024); scanf("%s",buf1);        sendto(sockfd,buf1,sizeof(buf1),0,&server,len);     recvfrom(sockfd,buf2,1024,0,&server,&len);        printf("%s\n",buf2);      } }
str [ALX025]Stop. Josh. I only want to talk to you.[ALX026]Why are you running from me, Josh?[ALX027]Please, Josh. Stop.[ALX028]Hey! Wait![ALX029]Josh? Wait![ALX030]Josh?[ALX031]Josh! Stop![ALX032]Hey! Where are you going?[ALX033]Josh. Hey, I want to talk to you.[ALX034]Josh. Why are you running?[ALX035]Hey. Stop running![ALX036]Wait-- Come back here.[ALX037]Hey-- Come back.[ALX038]Josh-- Come back here.[ALX039]Ahhhh. My head.[ALX040]Aghhhhhh....[ALX041]Ahhh. Not again... ahh..[ALX042]Ouch! Ack..[ALX043]Grrr... ahhhh...[ALX044]Wha? How did I get here? What is going on?[ALX045]That was strange. Why am I here now?[ALX046]I hate that.[ALX047]What the hell was that all about?[ALX048]I could do without the head pain. Geez.[ALX049]That was just strange.[ALX100]Good.[ALX102]Cool.[ALX104]Nice.[ALX106]Needed this.[ALX108]This'll help.[ALX110]I needed this.[ALX112]Uh-huh.[ALX114]Hmmm.[ALX116]Yes.[ALX118]Alright.[ALX120]Check.[ALX122]Affirmative.[ALX124]Done.[ALX126]No good.[ALX128]Dammit.[ALX130]Negative.[ALX132]Arrgh.[ALX134]Can't get through right now.[ALX136]No way through yet.[ALX138]I'll come back later.[ALX140]Nope. Maybe later.[ALX142]I'll try this later.[ALX144]I'll never get through here.[ALX146]It's blocked for a reason.[ALX148]Gotta find another way.[ALX150]Wrong way.[ALX152]Forget it.[ALX154]Embrace the pain, soldier on...embrace the pain, soldier on...[ALX156]Am I going crazy?[ALX158]Is my brain screwing with me?[ALX160]Is this real?[ALX162]Unbelievable.[ALX164]What was that?[ALX166]Are you there?[ALX168]Weird.[ALX170]Looks dangerous.[ALX172]All right.[ALX174]Nothing here.[ALX176]Huh, that's strange.[ALX178]Where'd it go?[ALX180]I swore it was here.[ALX182]Elle. Are you OK?[ALX184]Wheeler. Are you all right?[ALX186]Mom. Are you there?[ALX188]Something's there.[ALX190]Something's coming.[ALX192]What's that?[ALX194]Them again?[ALX196]Soldiers.[ALX198]The Order?[ALX200]Trouble.[ALX202]I know that sound.[ALX204]Another saw?[ALX206]What's down there?[ALX208]What's up there?[ALX210]Come out from there.[ALX212]What...is...that?[ALX214]Oh God...[ALX216]What the hell?[ALX218]Wolves...[ALX220]Animals.[ALX222]Something's growling.[ALX224]Something's moving.[ALX226]Something's coming.[ALX228]Bugs?[ALX230]Who's there?[ALX232]Hello?[ALX234]Elle?[ALX236]Who's there?[ALX238]Hello?[ALX240]Elle?[ALX242]What's that?[ALX244]Something's clicking.[ALX246]What's that sound?[ALX248]Something's burning.[ALX250]I can't breathe.[ALX252]What's that smell?[ALX254]Is that...metal?[ALX256]Whatever that is, it's serious.[ALX258]Oh shit.[ALX260]Hello.[ALX262]OK.[ALX264]Oh, man.[ALX266]These guys.[ALX268]Soldiers.[ALX270]Here we go.[ALX272]What the hell?[ALX274]What are you?[ALX276]Oh man.[ALX278]Oh God.[ALX280]What is that?[ALX282]Stay away from me.[ALX284]Great.[ALX286]Here, doggie.[ALX288]Here, boy.
SHH confirmed to appear at E3 and Leipzig Game Convention With just a few months away from the release of Silent Hill: Homecoming more and more coverage on the title is begining to surface. Konami have the game listed for an appearance at both E3 next week and next months Leipzig Game Convention. Silent Hill: Homecoming is expected to be one of Konami's main highlights during Leizpig in August and a much anticapated official trailer for Silent Hill: Homecoming is expected next week likely during Konami's press conference this coming wednesday at E3 which will be on the 16th July.The U.S. broadcast videogame show "G4" have confirmed they will feature Silent Hill: Homecoming in action from the show floor at E3 this Monday (July 14th). We will update you on any coverage of the title during E3 and Leipzig Game Convention as it comes.E3 starts from the 15th - 17th of July 2008 in Los Angeles.Leipzig Game Convention takes place the 20th - 24th of August.Source:http://www.g4tv.com/xplay/blog/post/686842/G4s_Massive_E308_Coverage_Announced.htmlhttp://www.videogaming247.com/2008/07/09/pes-2009-and-silent-hill-homecoming-confirmed-for-leipzig/http://www.thebitbag.com/2008/06/30/konami-press-conference-confirmed-for-07162008/悲しみに 鵺鸟鸣く  吾がかへり见すれど    花は散りぬべし  慰むる心は 消ぬるがごとく新世に神集ひて   夜は明け鵺鸟鸣く  咲く花は 神に祈ひ祷む  生ける世に 我が身悲しも  梦は消ぬ
1 下一页