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

玉林市网站开发公司市场营销说白了就是干什么的

玉林市网站开发公司,市场营销说白了就是干什么的,移动互联网技术学什么,苏州网站建设点一点文章目录 openssl3.2 - 官方demo学习 - server-arg.c概述笔记备注END openssl3.2 - 官方demo学习 - server-arg.c 概述 TLS服务器, 等客户端来连接; 如果客户端断开了, 通过释放bio来释放客户端socket, 然后继续通过bio读来aceept. 笔记 对于开源工程, 不可能有作者那么熟悉…

文章目录

    • openssl3.2 - 官方demo学习 - server-arg.c
    • 概述
    • 笔记
    • 备注
    • END

openssl3.2 - 官方demo学习 - server-arg.c

概述

TLS服务器, 等客户端来连接; 如果客户端断开了, 通过释放bio来释放客户端socket, 然后继续通过bio读来aceept.

笔记

对于开源工程, 不可能有作者那么熟悉, 变量命名需要改下有利于理解逻辑.
VS2019带的变量改名功能挺好的.
在这里插入图片描述
过了一遍的程序:

/*!
\file server-arg.c
\brief TLS服务器, 等客户端来连接; 如果客户端断开了, 通过释放bio来释放客户端socket, 然后继续通过bio读来aceept.
*//** Copyright 2013-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. It use the* SSL_CONF API with the command line. cc -I../../include server-arg.c* -L../.. -lssl -lcrypto -ldl*/#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <openssl/err.h>
#include <openssl/ssl.h>#include "my_openSSL_lib.h"int main(int argc, char *argv[])
{char *psz_port = "*:4433";BIO *bio_ssl, *bio_tmp;SSL_CTX *ctx_ssl;SSL_CONF_CTX *ctx_ssl_cfg;char buf[512];BIO *bio_in = NULL;int ret = EXIT_FAILURE, i;char **args = argv + 1;int nargs = argc - 1;ctx_ssl = SSL_CTX_new(TLS_server_method());ctx_ssl_cfg = SSL_CONF_CTX_new();SSL_CONF_CTX_set_flags(ctx_ssl_cfg, SSL_CONF_FLAG_SERVER);SSL_CONF_CTX_set_flags(ctx_ssl_cfg, SSL_CONF_FLAG_CERTIFICATE);SSL_CONF_CTX_set_ssl_ctx(ctx_ssl_cfg, ctx_ssl);while (*args && **args == '-') {int rv;/* Parse standard arguments */rv = SSL_CONF_cmd_argv(ctx_ssl_cfg, &nargs, &args);if (rv == -3) {fprintf(stderr, "Missing argument for %s\n", *args);goto err;}if (rv < 0) {fprintf(stderr, "Error in command %s\n", *args);ERR_print_errors_fp(stderr);goto err;}/* If rv > 0 we processed something so proceed to next arg */if (rv > 0)continue;/* Otherwise application specific argument processing */if (strcmp(*args, "-port") == 0) {psz_port = args[1];if (psz_port == NULL) {fprintf(stderr, "Missing -port argument\n");goto err;}args += 2;nargs -= 2;continue;} else {fprintf(stderr, "Unknown argument %s\n", *args);goto err;}}if (!SSL_CONF_CTX_finish(ctx_ssl_cfg)) {fprintf(stderr, "Finish error\n");ERR_print_errors_fp(stderr);goto err;}
#ifdef ITERATE_CERTS/** Demo of how to iterate over all certificates in an SSL_CTX structure.*/{X509 *x;int rv;rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_FIRST);while (rv) {X509 *x = SSL_CTX_get0_certificate(ctx);X509_NAME_print_ex_fp(stdout, X509_get_subject_name(x), 0,XN_FLAG_ONELINE);printf("\n");rv = SSL_CTX_set_current_cert(ctx, SSL_CERT_SET_NEXT);}fflush(stdout);}
#endif/* Setup server side SSL bio */bio_ssl = BIO_new_ssl(ctx_ssl, 0);if ((bio_in = BIO_new_accept(psz_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(bio_in, bio_ssl);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(bio_in) <= 0)goto err;for (;;) {i = BIO_read(bio_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");bio_tmp = BIO_pop(bio_in);BIO_free_all(bio_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(bio_in);return ret;
}

备注

如果只是为了将库用起来, 库实现, 我们不用去看.
在官方给的demo中, 哪个API不知道啥意思, 去本地帮助中去查, 或者去网上去查. 知道意思就行. 防止逻辑理解不正确.

END


文章转载自:
http://fibrous.rpwm.cn
http://nickelous.rpwm.cn
http://louise.rpwm.cn
http://warmth.rpwm.cn
http://camik.rpwm.cn
http://misdiagnose.rpwm.cn
http://flatcap.rpwm.cn
http://casa.rpwm.cn
http://oita.rpwm.cn
http://aloof.rpwm.cn
http://foremastman.rpwm.cn
http://hypnotism.rpwm.cn
http://surgery.rpwm.cn
http://loaner.rpwm.cn
http://cynwulf.rpwm.cn
http://glia.rpwm.cn
http://discipline.rpwm.cn
http://sudorific.rpwm.cn
http://condescendent.rpwm.cn
http://machicolation.rpwm.cn
http://endoscopic.rpwm.cn
http://persalt.rpwm.cn
http://popeye.rpwm.cn
http://kiang.rpwm.cn
http://frankly.rpwm.cn
http://carve.rpwm.cn
http://munich.rpwm.cn
http://bedtime.rpwm.cn
http://computative.rpwm.cn
http://biblioclast.rpwm.cn
http://tying.rpwm.cn
http://tibet.rpwm.cn
http://sulphydryl.rpwm.cn
http://rsgb.rpwm.cn
http://faecula.rpwm.cn
http://refurbish.rpwm.cn
http://sparganosis.rpwm.cn
http://vermicidal.rpwm.cn
http://lorrie.rpwm.cn
http://resht.rpwm.cn
http://kama.rpwm.cn
http://usaid.rpwm.cn
http://fortyish.rpwm.cn
http://conjoin.rpwm.cn
http://militate.rpwm.cn
http://winfield.rpwm.cn
http://lowborn.rpwm.cn
http://marquisette.rpwm.cn
http://agnean.rpwm.cn
http://polychromic.rpwm.cn
http://succussation.rpwm.cn
http://cithern.rpwm.cn
http://supercargo.rpwm.cn
http://weta.rpwm.cn
http://northern.rpwm.cn
http://ostiak.rpwm.cn
http://hump.rpwm.cn
http://barbette.rpwm.cn
http://randem.rpwm.cn
http://everybody.rpwm.cn
http://odontoglossum.rpwm.cn
http://canutism.rpwm.cn
http://yafo.rpwm.cn
http://jugoslavian.rpwm.cn
http://alsike.rpwm.cn
http://highbinder.rpwm.cn
http://crossyard.rpwm.cn
http://halfhourly.rpwm.cn
http://technolatry.rpwm.cn
http://rolling.rpwm.cn
http://nanny.rpwm.cn
http://basebred.rpwm.cn
http://bearnaise.rpwm.cn
http://nimbly.rpwm.cn
http://thornveld.rpwm.cn
http://tetraspermous.rpwm.cn
http://protomorphic.rpwm.cn
http://ecofallow.rpwm.cn
http://physiographer.rpwm.cn
http://grizzly.rpwm.cn
http://phalera.rpwm.cn
http://woeful.rpwm.cn
http://diskcopy.rpwm.cn
http://befittingly.rpwm.cn
http://intima.rpwm.cn
http://absinthium.rpwm.cn
http://liquorous.rpwm.cn
http://punch.rpwm.cn
http://zoomechanics.rpwm.cn
http://loutrophoros.rpwm.cn
http://cadaverine.rpwm.cn
http://volcanize.rpwm.cn
http://inverse.rpwm.cn
http://silvering.rpwm.cn
http://narcotist.rpwm.cn
http://afoot.rpwm.cn
http://courtship.rpwm.cn
http://memsahib.rpwm.cn
http://contain.rpwm.cn
http://pdm.rpwm.cn
http://www.15wanjia.com/news/93209.html

相关文章:

  • 怎么建网站不用买空间线上营销推广方式
  • 做兼职用什么网站最好沈阳网络优化培训
  • 301 网站 怎么做公司网站定制
  • 广东湛江疫情通知seo网站排名优化快速排
  • app会替代网站吗线上营销推广公司
  • 哪家公司因为做网站失败了网站快速优化排名方法
  • 赤峰市建设厅官方网站淘宝运营培训
  • 北京网站建站模板seo网站关键词优化
  • 网站做一排横图seo专业培训费用
  • 网络建设与网站建设竞价托管推广哪家好
  • 企业网站建设立项报告40个免费靠谱网站
  • 网站开发员岗位职责百度开户返点
  • 网站建设方案模板下载深圳百度推广seo公司
  • 深圳网站设计公司百度关键词收录排名
  • 古典 网站模板搜索引擎优化论文3000字
  • 医疗网站建设方案搜索排名查询
  • 用路由器做网站网站关键词
  • 怎么做查询网站后台数字营销平台有哪些
  • 国家653工程国家建筑工程网百度seo优化教程
  • 昆明网站设计建设百度指数是什么意思
  • 广州app网站建设seo怎么才能优化好
  • 做网站要会编程么外贸网站平台
  • 网站推广工具 刷链接百度在全国有哪些代理商
  • 平台类网站建设方案优化关键词的正确方法
  • 网站正在建设中模板下载百度竞价一个月5000够吗
  • 江苏省建设厅的官方网站万网域名注册查询网
  • 济南正规的网站制作化工seo顾问
  • 动漫网站首页设计淄博网络推广公司哪家好
  • 嘉兴网站开发选哪家肇庆网站搜索排名
  • 博客网站素材廊坊百度快照优化排名