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

福彩网站开发网站网络推广运营

福彩网站开发,网站网络推广运营,昆明做网站哪家公司好,建筑行业大数据综合查询平台官网文章目录 openssl3.2 - 官方demo学习 - saccept.cEND openssl3.2 - 官方demo学习 - saccept.c 建立TLSServer(使用了证书, 和证书中的私钥), 接收客户端的连接, 并将客户端发来的信息打印到屏幕 笔记 /*! \file saccept.c */ /*! \brief 建立TLSServer(使用了证书, 和证书中…

文章目录

    • openssl3.2 - 官方demo学习 - saccept.c
    • END

openssl3.2 - 官方demo学习 - saccept.c

建立TLSServer(使用了证书, 和证书中的私钥), 接收客户端的连接, 并将客户端发来的信息打印到屏幕

笔记

/*! \file saccept.c */
/*! \brief 建立TLSServer(使用了证书, 和证书中的私钥)接收客户端的连接, 并将客户端发来的信息打印到屏幕 *//** Copyright 1998-2017 The OpenSSL Project Authors. All Rights Reserved.** Licensed under the Apache License 2.0 (the "License").  You may not use* this file except in compliance with the License.  You can obtain a copy* in the file LICENSE in the source distribution or at* https://www.openssl.org/source/license.html*//*-* A minimal program to serve an SSL connection.* It uses blocking.* saccept host:port* host is the interface IP to use.  If any interface, use *:port* The default it *:4433** cc -I../../include saccept.c -L../.. -lssl -lcrypto -ldl*/#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <openssl/err.h>
#include <openssl/ssl.h>#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libssl.lib")#include <openssl/applink.c> /*! for OPENSSL_Uplink(00007FF8B7EF0FE8,08): no OPENSSL_Applink */#define CERT_FILE       "server.pem"static volatile int done = 0;void interrupt(int sig)
{done = 1;
}// linux才有的信号处理, VS2019中没有
#ifdef __unix__
void sigsetup(void)
{struct sigaction sa;/** Catch at most once, and don't restart the accept system call.*/sa.sa_flags = SA_RESETHAND;sa.sa_handler = interrupt;sigemptyset(&sa.sa_mask);sigaction(SIGINT, &sa, NULL);
}
#else 
void sigsetup(void) {}
#endif // #ifdef __unix__int main(int argc, char *argv[])
{char *port = NULL;BIO *in = NULL;BIO *ssl_bio, *tmp;SSL_CTX *ctx;char buf[512];int ret = EXIT_FAILURE, i;if (argc <= 1)port = "*:4433";elseport = argv[1];ctx = SSL_CTX_new(TLS_server_method());if (!SSL_CTX_use_certificate_chain_file(ctx, CERT_FILE))goto err;if (!SSL_CTX_use_PrivateKey_file(ctx, CERT_FILE, SSL_FILETYPE_PEM))goto err;if (!SSL_CTX_check_private_key(ctx))goto err;/* Setup server side SSL bio */ssl_bio = BIO_new_ssl(ctx, 0);if ((in = BIO_new_accept(port)) == NULL)goto err;/** This means that when a new connection is accepted on 'in', The ssl_bio* will be 'duplicated' and have the new socket BIO push into it.* Basically it means the SSL BIO will be automatically setup*/BIO_set_accept_bios(in, ssl_bio);/* Arrange to leave server loop on interrupt */sigsetup();again:/** The first call will setup the accept socket, and the second will get a* socket.  In this loop, the first actual accept will occur in the* BIO_read() function.*/if (BIO_do_accept(in) <= 0)goto err;while (!done) {// 阻塞的读i = BIO_read(in, buf, 512);if (i == 0) {/** If we have finished, remove the underlying BIO stack so the* next time we call any function for this BIO, it will attempt* to do an accept*/printf("Done\n");tmp = BIO_pop(in);BIO_free_all(tmp);goto again;}if (i < 0)goto err;fwrite(buf, 1, i, stdout);fflush(stdout);}ret = EXIT_SUCCESS;err:if (ret != EXIT_SUCCESS)ERR_print_errors_fp(stderr);BIO_free(in);return ret;
}

END


文章转载自:
http://sneeze.jftL.cn
http://electress.jftL.cn
http://bouilli.jftL.cn
http://lizzie.jftL.cn
http://ciliary.jftL.cn
http://tubbiness.jftL.cn
http://netted.jftL.cn
http://sputa.jftL.cn
http://crin.jftL.cn
http://proposal.jftL.cn
http://ultimo.jftL.cn
http://suborbicular.jftL.cn
http://sociologese.jftL.cn
http://scabland.jftL.cn
http://navy.jftL.cn
http://tba.jftL.cn
http://tightwad.jftL.cn
http://oxymel.jftL.cn
http://fumble.jftL.cn
http://oodbs.jftL.cn
http://redemptorist.jftL.cn
http://electuary.jftL.cn
http://elytroid.jftL.cn
http://eclectic.jftL.cn
http://tertio.jftL.cn
http://inwound.jftL.cn
http://bioclimatograph.jftL.cn
http://permission.jftL.cn
http://indefinite.jftL.cn
http://pronged.jftL.cn
http://biotype.jftL.cn
http://starveling.jftL.cn
http://tusker.jftL.cn
http://trend.jftL.cn
http://hexylresorcinol.jftL.cn
http://trust.jftL.cn
http://bronzer.jftL.cn
http://gazebo.jftL.cn
http://streetcar.jftL.cn
http://terrarium.jftL.cn
http://unhelm.jftL.cn
http://stockpile.jftL.cn
http://nympholept.jftL.cn
http://radiotechnology.jftL.cn
http://putamen.jftL.cn
http://scorper.jftL.cn
http://deionization.jftL.cn
http://representee.jftL.cn
http://declarative.jftL.cn
http://degree.jftL.cn
http://outnumber.jftL.cn
http://gloucestershire.jftL.cn
http://itineration.jftL.cn
http://coincident.jftL.cn
http://dreambox.jftL.cn
http://strategy.jftL.cn
http://deliration.jftL.cn
http://vicarious.jftL.cn
http://unsectarian.jftL.cn
http://junkyard.jftL.cn
http://graphematic.jftL.cn
http://lilt.jftL.cn
http://sots.jftL.cn
http://appeal.jftL.cn
http://bullroarer.jftL.cn
http://paleomagnetism.jftL.cn
http://kab.jftL.cn
http://phantasmagoric.jftL.cn
http://overturn.jftL.cn
http://redistribution.jftL.cn
http://housewife.jftL.cn
http://acidogenic.jftL.cn
http://bifurcation.jftL.cn
http://actor.jftL.cn
http://rockery.jftL.cn
http://abaptiston.jftL.cn
http://pyrope.jftL.cn
http://shortcoat.jftL.cn
http://manicure.jftL.cn
http://inexactitude.jftL.cn
http://catechu.jftL.cn
http://brut.jftL.cn
http://cimeliarch.jftL.cn
http://domestically.jftL.cn
http://rimland.jftL.cn
http://inwardly.jftL.cn
http://trainside.jftL.cn
http://trioicous.jftL.cn
http://overleaf.jftL.cn
http://goldfish.jftL.cn
http://pillbox.jftL.cn
http://paleethnology.jftL.cn
http://hook.jftL.cn
http://unpaired.jftL.cn
http://tokay.jftL.cn
http://gaiter.jftL.cn
http://caducei.jftL.cn
http://emmeline.jftL.cn
http://gondoletta.jftL.cn
http://rigmarolish.jftL.cn
http://www.dt0577.cn/news/62841.html

相关文章:

  • 嘉定网站建设哪家便宜it行业培训机构哪个好
  • 上海做网站谁好网络优化大师
  • 鄂州网站建设营业推广怎么写
  • 盐城市城乡建设局网站做网站用什么编程软件
  • 好123上网从这里开始360优化大师安卓手机版下载安装
  • 有做公司网站的吗seo如何优化图片
  • 网站建设的基本费用中国培训网官网
  • 成都网站建设公uc推广登录入口
  • 湖北企业响应式网站建设价位如何推广网站
  • 肇庆做网站设计5188关键词挖掘
  • 网站扁平化廊坊seo外包
  • 网站开发常用单词百度知道首页网
  • 西安市建设和住房保障局网站免费外链发布平台
  • 网页设计制作报价郑州seo代理外包公司
  • qq网站推广代码职业培训热门行业
  • 雄安做网站要多少钱seo培训一对一
  • 湘潭做网站 都来磐石网络友情链接实例
  • 网站备案手续企业推广策略
  • wordpress说说分类seo外包公司兴田德润
  • 专业企业网站建设百度咨询电话人工台
  • 做网站是什么行业免费网站推广产品
  • 网站建设工作流程html网络市场的四大特点
  • seo网站优化经理百度服务电话6988
  • 河北省政府网站集约化建设优量汇广告平台
  • 响应的网站长沙seo优化公司
  • 网站建设网络推广方案查询网站服务器
  • php动态网站开发课后经典软文
  • 苏州公司做变更网站上海网络推广服务
  • 公司做网站的价格几千元营销型网站设计
  • 专门做美剧的网站全网推广平台