freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

課程設計論文-基于linux網絡聊天室的設計-資料下載頁

2025-08-11 05:50本頁面
  

【正文】 y_addr。 if((sockfd = socket(AF_INET,SOCK_STREAM,0)) == 1){ perror(socket)。 exit(1)。 } = AF_INET。 = htons(MYPORT)。 = INADDR_ANY。 bzero(amp。(),8)。 if(bind(sockfd,(struct sockaddr*)amp。my_addr,sizeof(struct sockaddr)) == 1){ perror(bind)。 exit(1)。 } if(listen(sockfd,BACKLOG) == 1){ /*監(jiān)聽連接信號*/ perror(listen)。 exit(1)。 } if((pthread_create(amp。accthread,NULL,(void *)acceptconnect,NULL)) != 0){ printf(Create thread error!\r\n)。 exit(1)。 } while(1){ char msg[MAXDATASIZE]。 scanf(%s,msg)。 if(send(new_fd,msg,strlen(msg),0) == 1){ perror(send)。 close(new_fd)。 exit(1)。 } if(strcmp(msg,exit) == 0){ printf(Byebye!\n)。 close(new_fd)。 close(sockfd)。 exit(1)。 } } return 0。}客戶端源程序清單如下,includeincludeincludeincludeincludeincludesys/includenetinet/includesys/includedefine PORT 3490define MAXDATASIZE 1024int sockfd。pthread_t recthread。void recmessage(void){ while(1){ int numbytes。 char buf[MAXDATASIZE]。 if((numbytes = recv(sockfd,buf,MAXDATASIZE,0)) == 1){ perror(recv)。 exit(1)。 } buf[numbytes]=39。\039。 if(strcmp(buf,exit) == 0){ printf(Server is closed\n)。 close(sockfd)。 exit(1)。 } printf(Server:%s\n,buf)。 }}int main(int argc,char *argv[]){ struct hostent *he。 struct sockaddr_in their_addr。 if(argc != 2){ fprintf(stderr,usage:client hostname\n)。 exit(1)。 } if((he=gethostbyname(argv[1])) == NULL){ herror(gethostbyname)。 exit(1)。 } if((sockfd = socket(AF_INET,SOCK_STREAM,0)) == 1){ perror(socket)。 exit(1)。 } = AF_INET。 = htons(PORT)。 = *((struct in_addr *)heh_addr)。 bzero(amp。(),8)。 if(connect(sockfd,(struct sockaddr *)amp。their_addr,sizeof(struct sockaddr)) == 1)/*在面向連接的系統(tǒng)中客戶及連接服務器時使用*/{ perror(connect)。 exit(1)。 } if((pthread_create(amp。recthread,NULL,(void *)recmessage,NULL))!=0){ printf(Create thread error!\r\n)。 exit(1)。 } while(1){ char msg[MAXDATASIZE]。 scanf(%s,msg)。 if(send(sockfd,msg,strlen(msg),0) == 1){ perror(send)。 close(sockfd)。 exit(1)。 } if(strcmp(msg,exit) == 0){ printf(Byebye!\n)。 close(sockfd)。 exit(1)。 }} return 0。}
點擊復制文檔內容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1