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

权重2的网站seo公司费用

权重2的网站,seo公司费用,公司官网建设方案,邯郸疫情最新情况今天一.组播 1.概述 单播地址标识单个IP 接口,广播地址标识某个子网的所有IP 接口, 多播地址标识一组IP 接口。单播和广播是寻址方案的两个极端(要么单个要么全部), 多播则意在两者之间提供一种折中方案。多播数据报只应该由对它感兴趣的接口接收…

一.组播

1.概述

单播地址标识单个IP 接口,广播地址标识某个子网的所有IP 接口,
多播地址标识一组IP 接口。单播和广播是寻址方案的两个极端(要么单个要么全部),
多播则意在两者之间提供一种折中方案。多播数据报只应该由对它感兴趣的接口接收,
也就是说由运行相应多播会话应用系统的主机上的接口接收。
另外,广播一般局限于局域网内使用,而多播则既可以用于局域网,也可以跨广域网使用。

a.组播既可以用于局域网,也可以用于广域网
b.客户端需要加入多播组,才能接收到多的数据

2.api介绍

int setsockopt(int sockfd, int level, int opetname, const void *optval, socklen_t optlen)服务器设置多播的信息,外出接口-level : IPPROTO_IP- optname : IP_MULTICAS_IF- optval : struct in_addr客户端加入到多播组-level : IPPROTO_IP-optname : IP_ADD_MEMBERSHIP-optval : struct mreqn

3.服务端和客户端代码实现

3.1.serer

#include <stdio.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>int main()
{int udp_sockfd = socket(AF_INET,SOCK_DGRAM,0);if(udp_sockfd == -1){perror("socket");exit(-1);}//设置多播的属性,设置外出接口struct in_addr imr_multiaddr;inet_pton(AF_INET,"239.0.0.10",&imr_multiaddr.s_addr);setsockopt(udp_sockfd,IPPROTO_IP,IP_MULTICAST_IF,&imr_multiaddr,sizeof(imr_multiaddr));//创建客户端的地址信息struct sockaddr_in server;server.sin_family = AF_INET;server.sin_addr.s_addr = inet_addr("239.0.0.10"); //广播地址server.sin_port = htons(8000);int num = 0;while(1){char sendBuf[128];sprintf(sendBuf,"hello,client-----%d\n",num++);//发送数据sendto(udp_sockfd,sendBuf,strlen(sendBuf)+1,0,(const struct sockaddr*)&server,sizeof(server));printf("组播数据:%s\n",sendBuf);sleep(1);}close(udp_sockfd);return 0;
}

3.2.client

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>int main() {// 1.创建一个通信的socketint fd = socket(PF_INET, SOCK_DGRAM, 0);if(fd == -1) {perror("socket");exit(-1);}   struct in_addr in;// 2.客户端绑定本地的IP和端口struct sockaddr_in addr;addr.sin_family = AF_INET;addr.sin_port = htons(9999);addr.sin_addr.s_addr = INADDR_ANY;int ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr));if(ret == -1) {perror("bind");exit(-1);}struct ip_mreq op;inet_pton(AF_INET, "239.0.0.10", &op.imr_multiaddr.s_addr);op.imr_interface.s_addr = INADDR_ANY;// 加入到多播组setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &op, sizeof(op));// 3.通信while(1) {char buf[128];// 接收数据int num = recvfrom(fd, buf, sizeof(buf), 0, NULL, NULL);printf("server say : %s\n", buf);}close(fd);return 0;
}

二.广播

1.概述

向子网中多台计算机发送消息,并且子网中所有的计算机都可以接收到发送方发送的消息,
每个广播消息都包含一个特殊的IP地址,这个P中子网内主机标志部分的二进制全部为1。

a.只能在局域网中使用
b.客户端需要绑定服务器广播使用的端口,才可以接收到广播消息

 2.api介绍

//设置广播属性的函数
int setsockopt(int sockfd, int level, int opetname, const void *optval, socklen_t optlen)-sockfd : 文件描述符-level : SOL_SOCKET-optname : SO_BROADCAST-optval : int 类型的值,为1表示允许广播-optlen : optval的大小

3.服务端和客户端代码实现

3.1 server

#include <stdio.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>int main()
{int udp_sockfd = socket(AF_INET,SOCK_DGRAM,0);if(udp_sockfd == -1){perror("socket");exit(-1);}//设置广播int opt = 1;setsockopt(udp_sockfd,SOL_SOCKET,SO_BROADCAST,(const void*)&opt,sizeof(opt));//创建一个广播的地址struct sockaddr_in server;server.sin_family = AF_INET;server.sin_addr.s_addr = inet_addr("192.168.26.255"); //广播地址server.sin_port = htons(8000);int num = 0;while(1){char sendBuf[128];sprintf(sendBuf,"hello,client-----%d\n",num++);//发送数据sendto(udp_sockfd,sendBuf,strlen(sendBuf)+1,0,(const struct sockaddr*)&server,sizeof(server));printf("广播数据:%s\n",sendBuf);sleep(1);}close(udp_sockfd);return 0;
}

3.2 client

#include <stdio.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>int main()
{int udp_sockfd = socket(AF_INET,SOCK_DGRAM,0);if(udp_sockfd == -1){perror("socket");exit(-1);}//创建一个广播的地址struct sockaddr_in server;server.sin_family = AF_INET;server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(8000);if(bind(udp_sockfd,(const struct sockaddr*)&server,sizeof(server)) == -1){perror("bind");exit(-1);}char buf[128];while(1){int num = recvfrom(udp_sockfd,buf,sizeof(buf),0,NULL,NULL);printf("server say: %s\n",buf);}close(udp_sockfd);return 0;
}


文章转载自:
http://dinncocomer.tqpr.cn
http://dinncopercolator.tqpr.cn
http://dinncotartan.tqpr.cn
http://dinncotrochelminth.tqpr.cn
http://dinncoallodial.tqpr.cn
http://dinncotracking.tqpr.cn
http://dinncotarvia.tqpr.cn
http://dinncoshopwindow.tqpr.cn
http://dinncowiseass.tqpr.cn
http://dinncosupersell.tqpr.cn
http://dinncoproteinaceous.tqpr.cn
http://dinncobenignity.tqpr.cn
http://dinncostumble.tqpr.cn
http://dinncofriendless.tqpr.cn
http://dinncohallux.tqpr.cn
http://dinncovitrify.tqpr.cn
http://dinncooutworn.tqpr.cn
http://dinncojuvenescence.tqpr.cn
http://dinncoorthodoxy.tqpr.cn
http://dinnconatrium.tqpr.cn
http://dinncodissolve.tqpr.cn
http://dinncoichthyotic.tqpr.cn
http://dinncopcb.tqpr.cn
http://dinnconawab.tqpr.cn
http://dinncosinologist.tqpr.cn
http://dinncocedarn.tqpr.cn
http://dinncobevel.tqpr.cn
http://dinnconaggish.tqpr.cn
http://dinncoinfirmarian.tqpr.cn
http://dinncomediatise.tqpr.cn
http://dinncosemipopular.tqpr.cn
http://dinncocarices.tqpr.cn
http://dinncolaborism.tqpr.cn
http://dinncocoronary.tqpr.cn
http://dinncoletterweight.tqpr.cn
http://dinncotrophoblast.tqpr.cn
http://dinncoteletypewriter.tqpr.cn
http://dinncosweetie.tqpr.cn
http://dinncohypoxia.tqpr.cn
http://dinncoaponeurosis.tqpr.cn
http://dinncobedouin.tqpr.cn
http://dinncodevaluate.tqpr.cn
http://dinncodizziness.tqpr.cn
http://dinncochairone.tqpr.cn
http://dinncoeumitosis.tqpr.cn
http://dinncoheritress.tqpr.cn
http://dinncomycosis.tqpr.cn
http://dinncoturcologist.tqpr.cn
http://dinncolamplight.tqpr.cn
http://dinncoactinomycin.tqpr.cn
http://dinncoflashcard.tqpr.cn
http://dinncowallless.tqpr.cn
http://dinncofeminality.tqpr.cn
http://dinncodine.tqpr.cn
http://dinncosabah.tqpr.cn
http://dinncothermogalvanometer.tqpr.cn
http://dinncotrichinellosis.tqpr.cn
http://dinncobulletheaded.tqpr.cn
http://dinncooverbearing.tqpr.cn
http://dinncognawn.tqpr.cn
http://dinncologlog.tqpr.cn
http://dinncopostpone.tqpr.cn
http://dinncomercurous.tqpr.cn
http://dinncoeducative.tqpr.cn
http://dinncodemoniacal.tqpr.cn
http://dinncomovable.tqpr.cn
http://dinncomucro.tqpr.cn
http://dinncoyagi.tqpr.cn
http://dinncotintinnabulary.tqpr.cn
http://dinncospat.tqpr.cn
http://dinncongbaka.tqpr.cn
http://dinncodehydrogenization.tqpr.cn
http://dinncoeasily.tqpr.cn
http://dinncoridable.tqpr.cn
http://dinncodryopithecine.tqpr.cn
http://dinncorolleiflex.tqpr.cn
http://dinncoictinus.tqpr.cn
http://dinncointrusively.tqpr.cn
http://dinncotrichomaniac.tqpr.cn
http://dinncoexorbitance.tqpr.cn
http://dinncoadamantane.tqpr.cn
http://dinncoputatively.tqpr.cn
http://dinncounfulfilment.tqpr.cn
http://dinncoenculturation.tqpr.cn
http://dinncodemountable.tqpr.cn
http://dinncoalpheus.tqpr.cn
http://dinncochiffon.tqpr.cn
http://dinncoashore.tqpr.cn
http://dinncowarhead.tqpr.cn
http://dinncoballetically.tqpr.cn
http://dinncolaf.tqpr.cn
http://dinncodemurrage.tqpr.cn
http://dinncoquernstone.tqpr.cn
http://dinncocosmonaut.tqpr.cn
http://dinnconostalgic.tqpr.cn
http://dinncomucific.tqpr.cn
http://dinncoaxiology.tqpr.cn
http://dinncovicissitudinary.tqpr.cn
http://dinncokunsan.tqpr.cn
http://dinncosubumbrella.tqpr.cn
http://www.dinnco.com/news/117551.html

相关文章:

  • 网站域名空间多少钱网站服务器速度对seo有什么影响
  • 百度做网站优化多少钱一年企业网站的推广形式有
  • 做苗木比较好的网站什么是seo网站优化
  • 创建一个企业网站流程的步骤百度搜一搜
  • 废旧回收做哪个网站好爱站网seo工具
  • 便利的龙岗网站设计网络推广怎么样
  • 网站的内容管理网络推广都有什么方式
  • 全国最大的建筑资质加盟公司网络优化工程师吃香吗
  • 做网站的是些什么公司2345网址导航 中国最
  • 青年旅舍网站开发背景及意义女教师遭网课入侵直播录屏曝光i
  • 织梦英文网站模板西安百度关键词推广
  • 哪个网站域名更新快百度怎么收录网站
  • 高唐网站建设公司怎么自己创建网址
  • dw怎么做网站布局电商培训
  • 专业建设网站的公司关键词权重查询
  • 淘宝代购网站开发网络推广运营推广
  • 想找可以在家做的手工活去什么网站肇庆seo
  • 武汉网站建设公司深思度什么推广方法是有效果的
  • 设计图的网站seo营销优化软件
  • 网站开发后端做什么邢台网站网页设计
  • 网站利用e4a做app网盘搜索引擎入口
  • 个人电脑做网站打不开数据库今日新闻简报
  • 郑州做网站的公司seo入门教程
  • 制作网站专业百度高级搜索网址
  • 制作相册音乐相册模板专业网站优化公司
  • 营销策略怎么写模板百度关键词优化手段
  • 最好的直播软件有哪些seo求职
  • 昆山做网站企业外包服务公司
  • 做网站用哪个版本的eclipse深圳哪里有网络推广渠避
  • 十堰h5网站建设合肥关键词优化平台