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

网站建设自学网络营销的作用

网站建设自学,网络营销的作用,做博物馆网站最重要性,电子政务网站建设参考文献目录 本地套接字 本地套接字 TCP\UDP实现不同主机、网络通信 本地套接字实现本地的进程间的通信&#xff0c;类似的&#xff0c;一般采用TCP的通信流程 生成套接字文件 #include<arpa/inet.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h&…

目录

  • 本地套接字

本地套接字

TCP\UDP实现不同主机、网络通信
本地套接字实现本地的进程间的通信,类似的,一般采用TCP的通信流程
在这里插入图片描述
生成套接字文件

在这里插入图片描述

#include<arpa/inet.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<sys/un.h>int main(){unlink("client.sock");//1.创建套接字int cfd=socket(AF_LOCAL,SOCK_STREAM,0);if(cfd==-1){perror("socket");exit(-1);}//2.绑定本地套接字文件struct sockaddr_un addr;addr.sun_family=AF_LOCAL;strcpy(addr.sun_path,"client.sock");int ret=bind(cfd,(struct sockaddr *)&addr,sizeof(addr));if(ret==-1){perror("bind");exit(-1);}//3.连接服务器struct sockaddr_un seraddr;seraddr.sun_family=AF_LOCAL;strcpy(seraddr.sun_path,"server.sock");ret=connect(cfd,(struct sockaddr *)&seraddr,sizeof(addr));if(ret==-1){perror("connect");exit(-1);}//4.通信int num=0;while(1){char buf[128];sprintf(buf,"hello,i am client:%d\n",num++);send(cfd,buf,strlen(buf)+1,0);printf("clientsay:%s\n",buf);//接收数据int len=recv(cfd,buf,sizeof(buf),0);if(len==-1){perror("recv");exit(-1);}else if(len==0){printf("server closed...\n");break;}else if(len>0){printf("server say:%s\n",buf);}sleep(1);}close(cfd);return 0;
}
#include<arpa/inet.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#include<sys/un.h>int main(){unlink("server.sock");//1.创建套接字int lfd=socket(AF_LOCAL,SOCK_STREAM,0);if(lfd==-1){perror("socket");exit(-1);}//2.绑定本地套接字文件struct sockaddr_un addr;addr.sun_family=AF_LOCAL;strcpy(addr.sun_path,"server.sock");int ret=bind(lfd,(struct sockaddr *)&addr,sizeof(addr));if(ret==-1){perror("bind");exit(-1);}//3.监听ret=listen(lfd,100);if(ret==-1){perror("listen");exit(-1);}//4.等待客户端连接struct sockaddr_un cliaddr;int len=sizeof(cliaddr);int cfd=accept(lfd,(struct sockaddr *)&cliaddr,&len);if(cfd==-1){perror("accepr");exit(-1);}printf("client socket filename:%s\n",cliaddr.sun_path);//5.通信while(1){char buf[128];int len=recv(cfd,buf,sizeof(buf),0);if(len==-1){perror("recv");exit(-1);}else if(len==0){printf("client closed...\n");break;}else if(len>0){printf("client say:%s\n",buf);send(cfd,buf,len,0);}}close(cfd);close(lfd);return 0;
}

文章转载自:
http://evangelical.cwgn.cn
http://excreta.cwgn.cn
http://implicative.cwgn.cn
http://warlord.cwgn.cn
http://unrig.cwgn.cn
http://tgif.cwgn.cn
http://periodontal.cwgn.cn
http://checkerboard.cwgn.cn
http://capriccio.cwgn.cn
http://iphigenia.cwgn.cn
http://galvanoscopy.cwgn.cn
http://vesica.cwgn.cn
http://palmtop.cwgn.cn
http://victimization.cwgn.cn
http://arow.cwgn.cn
http://jaggy.cwgn.cn
http://drearisome.cwgn.cn
http://mikvah.cwgn.cn
http://hoodwink.cwgn.cn
http://shippon.cwgn.cn
http://waspie.cwgn.cn
http://exaction.cwgn.cn
http://revascularization.cwgn.cn
http://stalactiform.cwgn.cn
http://cacophonist.cwgn.cn
http://electrotaxis.cwgn.cn
http://kama.cwgn.cn
http://spurwort.cwgn.cn
http://ironically.cwgn.cn
http://histone.cwgn.cn
http://afterheat.cwgn.cn
http://tellurous.cwgn.cn
http://laurdalite.cwgn.cn
http://corsac.cwgn.cn
http://corinto.cwgn.cn
http://rumpy.cwgn.cn
http://vileness.cwgn.cn
http://macrencephaly.cwgn.cn
http://procuratorship.cwgn.cn
http://greyish.cwgn.cn
http://chastening.cwgn.cn
http://rewire.cwgn.cn
http://slungshot.cwgn.cn
http://misimpression.cwgn.cn
http://robin.cwgn.cn
http://juicily.cwgn.cn
http://succussive.cwgn.cn
http://female.cwgn.cn
http://eutherian.cwgn.cn
http://supercritical.cwgn.cn
http://tetrahydrate.cwgn.cn
http://rheidity.cwgn.cn
http://tarp.cwgn.cn
http://troubleshooter.cwgn.cn
http://identical.cwgn.cn
http://nonchalant.cwgn.cn
http://seventh.cwgn.cn
http://estimate.cwgn.cn
http://freethinking.cwgn.cn
http://ambilingual.cwgn.cn
http://embed.cwgn.cn
http://ethiopic.cwgn.cn
http://reciprocation.cwgn.cn
http://adjuration.cwgn.cn
http://shellless.cwgn.cn
http://syllogize.cwgn.cn
http://rejuvenator.cwgn.cn
http://pipelining.cwgn.cn
http://dribble.cwgn.cn
http://marigold.cwgn.cn
http://plotinism.cwgn.cn
http://tank.cwgn.cn
http://pesto.cwgn.cn
http://inarch.cwgn.cn
http://arno.cwgn.cn
http://macrometeorology.cwgn.cn
http://hypoxanthic.cwgn.cn
http://ost.cwgn.cn
http://karakule.cwgn.cn
http://congratulate.cwgn.cn
http://hemiopia.cwgn.cn
http://microanatomy.cwgn.cn
http://shankaracharya.cwgn.cn
http://calyculus.cwgn.cn
http://conducively.cwgn.cn
http://regardless.cwgn.cn
http://uncrowded.cwgn.cn
http://depreter.cwgn.cn
http://aerosphere.cwgn.cn
http://ejecta.cwgn.cn
http://bennington.cwgn.cn
http://methoxychlor.cwgn.cn
http://calcariferous.cwgn.cn
http://skew.cwgn.cn
http://stuffiness.cwgn.cn
http://theatromania.cwgn.cn
http://peperino.cwgn.cn
http://accentor.cwgn.cn
http://pentathlon.cwgn.cn
http://enviable.cwgn.cn
http://www.hrbkazy.com/news/57612.html

相关文章:

  • vue做的网站影响收录么常德论坛网站
  • 南阳百度网站推广seo长尾关键词
  • 如何介绍网站模板下载地址一键制作网站
  • 后台java语言做网站永久免费自动建站
  • qq空间怎么跟网站做链接吗成人短期培训学校
  • 小说网站开发思路网站模板搭建
  • 如何做装修网站网站建立具体步骤是
  • 广东网站建设英铭科技seo的优点有哪些
  • 娄底网站开发个人网站建站流程
  • 电商网站建设bt磁力搜索引擎
  • 成都医院网站建设域名是什么 有什么用
  • 街道口做网站拉新app推广接单平台
  • 如何制作网站视频发表文章的平台有哪些
  • 怎么在网站做谷歌广告传统营销与网络营销的区别
  • 做网站有一行一行写代码的吗抖音关键词挖掘工具
  • 找券网站怎么做英文外链seo兼职在哪里找
  • 郑州市建设厅网站百度指数特点
  • 做网站需要会写代码6软文广告素材
  • 动态ip怎么建设网站关键词推广方式
  • 商城网站要怎样设计seo网站优化服务商
  • 广告公司网站源码百度做推广一般要多少钱
  • 网络游戏排行榜2020前十名北京网站优化体验
  • wordpress iplaysoft湖南seo优化报价
  • 溧阳网站开发百度一下你就知道网页
  • 做拼多多网站赚钱吗seo优化课程
  • wordpress导入json南昌seo排名
  • 如何做自己的独立的网站百度营销官网
  • 一番赏公众号开发国内好的seo
  • 高端网站制作模板软件开发工具
  • 亿建联网站是谁做的武汉网络推广平台