当前位置: 首页 > news >正文

html做网站步骤网站开发和设计如何合作

html做网站步骤,网站开发和设计如何合作,怎么用idea做响应式网站,惠州地区网站建设公司多进程并发服务器 多线程并发服务器 I/O多路转接服务器 epoll的工作模式 1 多进程并发服务器 在多进程并发服务器中#xff0c;若有用户请求到达#xff0c;服务器将会调用fork()函数#xff0c;创建一个子进程#xff0c;之后父进程将继续调用accept()#xff0c;而子进…多进程并发服务器 多线程并发服务器 I/O多路转接服务器 epoll的工作模式 1 多进程并发服务器 在多进程并发服务器中若有用户请求到达服务器将会调用fork()函数创建一个子进程之后父进程将继续调用accept()而子进程则去处理用户请求。 【案例1】构建多进程并发服务器。 服务器端接收多个客户端的数据并将接收到的数据转为大写写回客户端客户端向服务器发送数据并将服务器返回的数据打印到终端。 forkserver.c #include arpa/inet.h #include signal.h #include sys/wait.h #include sys/types.h #include wrap.h #define MAXLINE 80 //缓冲数组大小 #define SERV_PORT 8000 //端口号 //子进程回收函数 void doSigChild(int paraNum) {while (waitpid(0, NULL, WNOHANG) 0); } //of doSigChild int main() {struct sockaddr_in tempServAddr, tempCliAddr;socklen_t tempCliAddrLen;int tempListenFd, tempConnFd;char tempBuf[MAXLINE];char tempStr[INET_ADDRSTRLEN];int i, tempDataLen;pid_t tempPid;struct sigaction tempNewAct;tempNewAct.sa_handler doSigChild;sigaction(SIGCHLD, tempNewAct, NULL); //信号捕获与处理回收子进程tempListenFd Socket(AF_INET, SOCK_STREAM, 0);//设置服务器端口地址bzero(tempServAddr, sizeof(tempServAddr));tempServAddr.sin_family AF_INET;tempServAddr.sin_addr.s_addr htonl(INADDR_ANY);tempServAddr.sin_port htons(SERV_PORT);//使服务器与端口绑定Bind(tempListenFd, (struct sockaddr *)tempServAddr, sizeof(tempServAddr));Listen(tempListenFd, 20);printf(Accepting connections ...\n);while (1) {tempCliAddrLen sizeof(tempCliAddr);tempConnFd Accept(tempListenFd, (struct sockaddr *)tempCliAddr, tempCliAddrLen);tempPid fork(); //创建子进程if (tempPid 0) {//子进程处理客户端请求Close(tempListenFd);while (1) {tempDataLen Read(tempConnFd, tempBuf, MAXLINE);if (tempDataLen 0) {printf(the other side has been closed.\n);break;}//of if//打印客户端端口信息printf(received from %s at PORT %d\n,inet_ntop(AF_INET, tempCliAddr.sin_addr, tempStr, sizeof(tempStr)),ntohs(tempCliAddr.sin_port));for (i 0; i tempDataLen; i) {tempBuf[i] toupper(tempBuf[i]);} //of for iWrite(tempConnFd, tempBuf, tempDataLen);}//of whileClose(tempConnFd);return 0;} else if (tempPid 0) {Close(tempConnFd);} else {perr_exit(fork);}//of if}//of whileClose(tempListenFd);return 0; }//of mainforkclient.c #include stdio.h #include string.h #include unistd.h #include netinet/in.h #include wrap.h #define MAXLINE 80 //缓冲数组大小 #define SERV_PORT 8000 //端口号 int main() {struct sockaddr_in tempServAddr;char tempBuf[MAXLINE];int tempSockFd, tempDataLen;tempSockFd Socket(AF_INET, SOCK_STREAM, 0);bzero(tempServAddr, sizeof(tempServAddr));tempServAddr.sin_family AF_INET;inet_pton(AF_INET, 127.0.0.1, tempServAddr.sin_addr);tempServAddr.sin_port htons(SERV_PORT);Connect(tempSockFd, (struct sockaddr *)tempServAddr, sizeof(tempServAddr));while (fgets(tempBuf, MAXLINE, stdin) ! NULL) {Write(tempSockFd, tempBuf, strlen(tempBuf));tempDataLen Read(tempSockFd, tempBuf, MAXLINE);if (tempDataLen 0) {printf(the other side has been closed.\n);} else {Write(STDOUT_FILENO, tempBuf, tempDataLen);}//of if}//of whileClose(tempSockFd);return 0; } //of main
http://www.zqtcl.cn/news/82269/

相关文章:

  • cq网络网站jquery 手机网站开发
  • 学校网站建设 应用情况软文500字范文
  • 网站建设网站建设教程推广网站方案
  • 查公司信息的网站白熊阅读做网站架构
  • 网站什么时候备案好花西子品牌营销策略研究论文
  • 做音乐网站需要什么最火的网页游戏
  • 免费的行情网站推荐下载安装wordpress怎么添加标签页
  • 东莞企业网站排名优化wordpress文件上传路径在哪修改
  • 微信公众号手机网站开发危险网站解除
  • 校园网站建设资金来源有怎么做小说推广挣钱
  • 家用宽带做网站微信网站设计欣赏
  • 自贡建设监督质量网站杭州网站做的好公司
  • 如何用PS制作网站首页织梦网站环境
  • 网站的后台地址专业的网页制作服务
  • 南京网站制作公司招聘上海设计公司排名前十强20
  • 甘肃永靖建设住建局网站vs网页设计教程
  • 学校网站群建设思路互联网营销的优势
  • 家政服务公司网站建设方案策划书物流网点查询官网
  • 高端制作网站设计济南网站建设公司选济南网络
  • 做网站的网络非要专线吗网站平台建设工作汇报
  • 广西专业做网站的公司wordpress未登录用户重定向
  • 中国建设银行复核网站寿光市住房和建设局网站
  • 企业服务 免费网站建设大连网站设计收费标准
  • 深圳网站制作公司免签支付 wordpress
  • 开发网站监控推荐广州乐地网站建设
  • 摄影网站定位fi网页动图制作
  • 网站建设需求方案文档网站宣传方式有哪些
  • 广州海珠区赤岗 新港网站建设公司中安(深圳)建设公司成员
  • 国外网站网址centos7删除wordpress
  • 沧州国外网站建设钓鱼网站下载安装