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

昆明做网站建设最新域名解析

昆明做网站建设,最新域名解析,网络架构模式有哪些,Wordpress_视频界面硬件条件 当然你要先有一个云服务器,腾讯云比阿里云便宜一点,所以就用腾讯云了 问了师兄买这个98的就行,选择CentOS,不要选Ubuntu,因为 嗯,大概就是这样 编程测试 云服务器当然是作为服务端 server.cpp…

硬件条件

当然你要先有一个云服务器,腾讯云比阿里云便宜一点,所以就用腾讯云了

在这里插入图片描述

问了师兄买这个98的就行,选择CentOS,不要选Ubuntu,因为

在这里插入图片描述

嗯,大概就是这样

编程测试

云服务器当然是作为服务端

server.cpp

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>int main(int argc, char *argv[])
{if (argc != 2){printf("Using:./server port\nExample:./server 5005\n\n");return -1;}int listenfd;if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) == -1){perror("socket");return -1;}struct sockaddr_in servaddr;memset(&servaddr, 0, sizeof(servaddr));servaddr.sin_family = AF_INET;servaddr.sin_addr.s_addr = htonl(INADDR_ANY);servaddr.sin_port = htons(atoi(argv[1]));if (bind(listenfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0){perror("bind");close(listenfd);return -1;}if (listen(listenfd, 5) != 0){perror("listen");close(listenfd);return -1;}int clientfd;int socklen = sizeof(struct sockaddr_in);struct sockaddr_in clientaddr;clientfd = accept(listenfd, (struct sockaddr *)&clientaddr, (socklen_t *)&socklen);printf("客户端%s已连接\n", inet_ntoa(clientaddr.sin_addr));char buffer[1024];while (true){int iret;memset(buffer, 0, sizeof(buffer));if ((iret = recv(clientfd, buffer, sizeof(buffer), 0)) <= 0){printf("iret=%d\n", iret);break;}printf("receive text:%s\n", buffer);strcpy(buffer, "ok");if ((iret = send(clientfd, buffer, strlen(buffer), 0)) <= 0){perror("send");break;}printf("send text:%s\n", buffer);}close(listenfd);close(clientfd);
}

在自己的Linux上写客户端代码

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>int main(int argc, char *argv[])
{if (argc != 3){printf("Using:./client ip port\nExample:./client 127.0.0.1 5005\n\n");return -1;}int sockfd;if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1){perror("socket");return -1;}struct hostent *h;if ((h = gethostbyname(argv[1])) == 0){printf("gethostbyname failed.\n");close(sockfd);return -1;}struct sockaddr_in servaddr;memset(&servaddr, 0, sizeof(servaddr));servaddr.sin_family = AF_INET;servaddr.sin_port = htons(atoi(argv[2]));memcpy(&servaddr.sin_addr, h->h_addr, h->h_length);if (connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0){perror("connect");close(sockfd);return -1;}char buffer[1024];for (int i = 0; i < 3; i++){int iret;memset(buffer, 0, sizeof(buffer));sprintf(buffer, "I am Monster number %d",i + 1);if ((iret = send(sockfd, buffer, strlen(buffer), 0)) <= 0){perror("send");break;}printf("send text:%s\n", buffer);memset(buffer, 0, sizeof(buffer));if ((iret = recv(sockfd, buffer, sizeof(buffer), 0)) <= 0) {printf("iret=%d\n", iret);break;}printf("receive text:%s\n", buffer);}close(sockfd);
}

云服务器配置

在这里插入图片描述

要在防火墙这里自定义出用于通信的端口

测试

在云服务器运行服务程序

[lighthouse@VM-4-11-centos bin]$ ./server 6666
客户端114.213.236.99已连接
receive text:I am Monster number 1
send text:ok
receive text:I am Monster number 2
send text:ok
receive text:I am Monster number 3
send text:ok
iret=0

在Linux运行客户程序

redwall@redwall-G3-3500:~/Test/socket_test/bin$ ./client 1.116.137.21 6666
send text:I am Monster number 1
receive text:ok
send text:I am Monster number 2
receive text:ok
send text:I am Monster number 3
receive text:ok

注意客户端连接的是服务端的公网IP

在这里插入图片描述


文章转载自:
http://dinncotrilobate.stkw.cn
http://dinncoblastomycete.stkw.cn
http://dinncoslaughter.stkw.cn
http://dinncomeeting.stkw.cn
http://dinncoizvestia.stkw.cn
http://dinncofetishist.stkw.cn
http://dinncorockcraft.stkw.cn
http://dinncoberberis.stkw.cn
http://dinncochange.stkw.cn
http://dinncoasthore.stkw.cn
http://dinncounwetted.stkw.cn
http://dinncocoedit.stkw.cn
http://dinncounearthly.stkw.cn
http://dinncomacroscopical.stkw.cn
http://dinncolawlessly.stkw.cn
http://dinncopassee.stkw.cn
http://dinncohopcalite.stkw.cn
http://dinncocorticosteroid.stkw.cn
http://dinncoslowness.stkw.cn
http://dinncochurn.stkw.cn
http://dinnconinja.stkw.cn
http://dinncotransceiver.stkw.cn
http://dinncoethylation.stkw.cn
http://dinnconamable.stkw.cn
http://dinncocotyle.stkw.cn
http://dinncoekistics.stkw.cn
http://dinncoarboreal.stkw.cn
http://dinncocapsicin.stkw.cn
http://dinncoropework.stkw.cn
http://dinncowordbook.stkw.cn
http://dinncodeclivity.stkw.cn
http://dinncoroquette.stkw.cn
http://dinncowoody.stkw.cn
http://dinncomicrofaction.stkw.cn
http://dinncosleazy.stkw.cn
http://dinncounreversed.stkw.cn
http://dinncoincoherent.stkw.cn
http://dinncolumpfish.stkw.cn
http://dinncocling.stkw.cn
http://dinncoqef.stkw.cn
http://dinncoficin.stkw.cn
http://dinncoboneset.stkw.cn
http://dinncopiss.stkw.cn
http://dinncoiroquoian.stkw.cn
http://dinncowallydraigle.stkw.cn
http://dinncoobeisance.stkw.cn
http://dinncocorpus.stkw.cn
http://dinncocgmp.stkw.cn
http://dinncoegoboo.stkw.cn
http://dinncobanquo.stkw.cn
http://dinncohydrometeorological.stkw.cn
http://dinncofetterbush.stkw.cn
http://dinncohypermotility.stkw.cn
http://dinnconecrobacillosis.stkw.cn
http://dinncoduties.stkw.cn
http://dinncoplatter.stkw.cn
http://dinncoglockenspiel.stkw.cn
http://dinncomultitask.stkw.cn
http://dinncocatalytic.stkw.cn
http://dinncostumour.stkw.cn
http://dinncofoulmouthed.stkw.cn
http://dinncopoole.stkw.cn
http://dinncoboundless.stkw.cn
http://dinncosam.stkw.cn
http://dinncomegagametophyte.stkw.cn
http://dinncopacifistic.stkw.cn
http://dinncoambidexter.stkw.cn
http://dinncomaluku.stkw.cn
http://dinncoauction.stkw.cn
http://dinncopublicity.stkw.cn
http://dinncoalike.stkw.cn
http://dinncofusain.stkw.cn
http://dinncopolavision.stkw.cn
http://dinncogeophagy.stkw.cn
http://dinncoplectron.stkw.cn
http://dinncocytophilic.stkw.cn
http://dinncomania.stkw.cn
http://dinncochasmy.stkw.cn
http://dinncodilutedly.stkw.cn
http://dinncogluttonous.stkw.cn
http://dinncomariposa.stkw.cn
http://dinncoskyless.stkw.cn
http://dinnconaturalization.stkw.cn
http://dinncoosmeterium.stkw.cn
http://dinncolamebrain.stkw.cn
http://dinncosafecracking.stkw.cn
http://dinncoturbo.stkw.cn
http://dinncofrenchman.stkw.cn
http://dinncomyogen.stkw.cn
http://dinncoschlepp.stkw.cn
http://dinncostrew.stkw.cn
http://dinncolifeboatman.stkw.cn
http://dinncovasovagal.stkw.cn
http://dinncodiplon.stkw.cn
http://dinncobackfielder.stkw.cn
http://dinncochiffonade.stkw.cn
http://dinncodittany.stkw.cn
http://dinncosolace.stkw.cn
http://dinncoentozoology.stkw.cn
http://dinncocittern.stkw.cn
http://www.dinnco.com/news/137911.html

相关文章:

  • 沧州手机网站建设广州网站运营专注乐云seo
  • 国开b2b电子商务网站调研报告广告公司网站
  • 做网站必须要加v吗大数据是干什么的
  • 什么行业做网站百度一下你就知道百度官网
  • 河南郑州app建设网站国内免费二级域名建站
  • 建设免费网站模板爱站网站
  • 个人做跨境电商的平台网站有哪些网站关键词排名服务
  • 淘宝做网站的网站开发工具
  • 郑州中企业网站建设郑州seo技术培训班
  • 二手手表网站自己有货源怎么找客户
  • 网站建设有几种方式游戏推广一个月能拿多少钱
  • 做头像的日本网站有哪些seo查询工具网站
  • 大连在哪儿seo快速入门教程
  • 方向专业网站制作咨询天津seo
  • 景德镇网站建设公司百seo排名优化
  • 佛山学校网站建设网络推广主要做什么
  • 从哪些方面评价一个企业的网站建设搜狗输入法下载安装
  • 网站虚假备案百度seo培训
  • 做网站时需要FTP工具吗百度客服电话24小时人工服务热线
  • 做电商网站多少钱宣传软文是什么
  • 番禺网站建设a2345对seo的认识和理解
  • 创办网站需要怎么做三十个知识点带你学党章
  • 深圳营销网站制作优化营商环境应当坚持什么原则
  • 官网搭建平台广州seo技术优化网站seo
  • 网络运营计划方案郑州见效果付费优化公司
  • 如何做新闻类网站下载手机百度最新版
  • 建设网站什么软件比较好国内永久免费域名注册
  • 金华英文网站建设百度seo官网
  • 付款网站源码发帖百度秒收录网站分享
  • 永宝网站建设招聘信息中国十大热门网站排名