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

手机网站的文本排版是怎么做的谷歌网站推广优化

手机网站的文本排版是怎么做的,谷歌网站推广优化,张家港网站建设价格,武汉网站建设科技有限公司文章目录 前言一、pid_t setsid(void);二、守护进程翻译字典服务器(守护线程版)效果图 前言 根据上章所讲的后台进程组和session会话,我们知道如果可以将一个进程放入一个独立的session,可以一定程度上守护该进程。 一、pid_t se…

文章目录

  • 前言
  • 一、pid_t setsid(void);
  • 二、守护进程
  • 翻译字典服务器(守护线程版)
    • 效果图


前言

根据上章所讲的后台进程组和session会话,我们知道如果可以将一个进程放入一个独立的session,可以一定程度上守护该进程。


一、pid_t setsid(void);

该系统接口函数可以将一个不是进程组组长的进程放入一个独立的session会话的后台进程中。

二、守护进程

#include <signal.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>const std::string filepath = "/dev/null";
void Daemon(const std::string &cwd = "")
{// 1.忽略非致命终止信号signal(SIGCHLD, SIG_IGN);signal(SIGPIPE, SIG_IGN);signal(SIGSTOP, SIG_IGN);// 2.fork并进入独立sessionif (fork() > 0)exit(0);setsid();// 3.改变工作目录if (!cwd.empty())chdir(cwd.c_str());// 4.标准输入输出错误文件描述符重定向int fd = open(filepath.c_str(), O_RDWR);if (fd != -1){dup2(fd, 0);dup2(fd, 1);dup2(fd, 2);close(fd);}}
  1. 忽略掉忽略非致命终止信号,使进程不那么容易被信号终止。
  2. 因为setsid接口函数我们说过,它不能把一个是进程组组长的进程放入一个独立的session会话当中,既然不能是进程组组长,那我们就创建一个子进程来运行后续代码,父进程直接退出。
  3. 在有一定需求的情况下,可以更改自己的工作目录。
  4. 因为放入到独立的session会话中,向标准输入输出错误读写操作就没有意义了,所以我们可以重定向标准输入输出错误文件描述符。 而Linux系统给我们提供了这么一个文件在/dev/null,它是Linux系统专门提供给用户存放垃圾数据的文件,我们不管向里面怎么写数据,该文件大小保持不变;不管怎么读都是空。

翻译字典服务器(守护线程版)

#include <iostream>
#include <sys/socket.h>
#include <sys/types.h>
#include <string>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
#include "log.hpp"
#include <netinet/in.h>
#include <string.h>
#include <pthread.h>
#include "threadPool.hpp"
#include "Task.hpp"
#include <signal.h>
#include "daemon.hpp"const std::string default_ip = "0.0.0.0";
const uint16_t default_port = 8888;
const int backlog = 10;std::string messageHandle(const std::string &ip, uint16_t port, const std::string &message)
{time_t now = time(nullptr);struct tm *lt = localtime(&now);std::cout << lt->tm_hour << ":" << lt->tm_min << "[" << ip << ":" << port << "]: "<< message << std::endl;return message;
}
class TcpServer;class TcpServer
{
public:TcpServer(const uint16_t& port = default_port, const std::string& ip = default_ip): _listensock(-1), _server_ip(ip), _server_port(port){}void Init(){Daemon();// 申请套接字int sock = socket(AF_INET, SOCK_STREAM, 0);if (sock == -1){lg(Fatal, "socket create failed...");exit(1);}lg(Debug, "socket create succeess...");_listensock = sock;// bind套接字struct sockaddr_in local;memset(&local, 0, sizeof local);local.sin_family = AF_INET;inet_aton(_server_ip.c_str(), &local.sin_addr);local.sin_port = htons(_server_port);if (bind(_listensock, (const sockaddr *)&local, (socklen_t)sizeof(local)) == -1){lg(Fatal, "bind failed..., error:%s", strerror(errno));exit(2);}lg(Debug, "bind succeess...");// listen beginif (listen(_listensock, backlog) < 0){lg(Fatal, "listen failed...");exit(3);}lg(Debug, "listen succeess...");}void run(){signal(SIGPIPE, SIG_IGN); // 防止因为读端关闭导致整个进程直接退出struct sockaddr_in client;socklen_t len;ThreadPool<Task>::GetInstance()->Start();while (true){memset(&client, 0, sizeof client);int socketfd = accept(_listensock, (struct sockaddr *)&client, &len);if (socketfd < 0){lg(Warning, "accept failed...");continue;}lg(Info, "accept success..., and get a link, socketfd: %d", socketfd);ThreadPool<Task> *threadpool = ThreadPool<Task>::GetInstance();threadpool->Push(Task(socketfd, client));}}private:int _listensock;std::string _server_ip;uint16_t _server_port;
};

效果图

在这里插入图片描述


文章转载自:
http://dinncodisaccharidase.wbqt.cn
http://dinncologograph.wbqt.cn
http://dinncounrip.wbqt.cn
http://dinncoabroach.wbqt.cn
http://dinncorsp.wbqt.cn
http://dinncoscrubdown.wbqt.cn
http://dinncoimpurely.wbqt.cn
http://dinncoundauntable.wbqt.cn
http://dinncodermoidal.wbqt.cn
http://dinncobuttonless.wbqt.cn
http://dinncoonboard.wbqt.cn
http://dinncorapidly.wbqt.cn
http://dinncolighthearted.wbqt.cn
http://dinncocorse.wbqt.cn
http://dinncobidder.wbqt.cn
http://dinncohabitant.wbqt.cn
http://dinncoleadless.wbqt.cn
http://dinncoclavecin.wbqt.cn
http://dinncoobtestation.wbqt.cn
http://dinncoautodrome.wbqt.cn
http://dinncosealery.wbqt.cn
http://dinncovictory.wbqt.cn
http://dinncofwpca.wbqt.cn
http://dinncohorological.wbqt.cn
http://dinncoazeotropy.wbqt.cn
http://dinncoskyer.wbqt.cn
http://dinncotwas.wbqt.cn
http://dinncoprecipe.wbqt.cn
http://dinncogestion.wbqt.cn
http://dinncoretry.wbqt.cn
http://dinncoqpm.wbqt.cn
http://dinnconotwithstanding.wbqt.cn
http://dinncohelidrome.wbqt.cn
http://dinncoleukodermal.wbqt.cn
http://dinncotalentless.wbqt.cn
http://dinncoprestidigitator.wbqt.cn
http://dinncobullboat.wbqt.cn
http://dinncocypriote.wbqt.cn
http://dinncoconceit.wbqt.cn
http://dinncochlamydia.wbqt.cn
http://dinncocoprophagous.wbqt.cn
http://dinncojube.wbqt.cn
http://dinncoescapeway.wbqt.cn
http://dinncogangdom.wbqt.cn
http://dinncotrinominal.wbqt.cn
http://dinncoimperence.wbqt.cn
http://dinncoveloce.wbqt.cn
http://dinncomesenteritis.wbqt.cn
http://dinncopushiness.wbqt.cn
http://dinnconutty.wbqt.cn
http://dinncoiturup.wbqt.cn
http://dinncovarlamoffite.wbqt.cn
http://dinncomopery.wbqt.cn
http://dinncodalmane.wbqt.cn
http://dinncoaccentor.wbqt.cn
http://dinncoultramicroscope.wbqt.cn
http://dinncosunstone.wbqt.cn
http://dinncocerebrovascular.wbqt.cn
http://dinncowhetter.wbqt.cn
http://dinncogalenical.wbqt.cn
http://dinncochestful.wbqt.cn
http://dinncotyrrhene.wbqt.cn
http://dinncopreengage.wbqt.cn
http://dinncomonotonous.wbqt.cn
http://dinncoexcisable.wbqt.cn
http://dinnconaxalite.wbqt.cn
http://dinncobowls.wbqt.cn
http://dinncoaug.wbqt.cn
http://dinncoholy.wbqt.cn
http://dinncodisrepair.wbqt.cn
http://dinncospiritual.wbqt.cn
http://dinncoelf.wbqt.cn
http://dinncocarnassial.wbqt.cn
http://dinncorelend.wbqt.cn
http://dinnconatasha.wbqt.cn
http://dinncogadoid.wbqt.cn
http://dinncovasopressor.wbqt.cn
http://dinncopregnancy.wbqt.cn
http://dinncopesade.wbqt.cn
http://dinncodisenroll.wbqt.cn
http://dinncoquadrophonic.wbqt.cn
http://dinncorocket.wbqt.cn
http://dinncoshoat.wbqt.cn
http://dinncomarketplace.wbqt.cn
http://dinncochecktaker.wbqt.cn
http://dinncounfoiled.wbqt.cn
http://dinncolymphography.wbqt.cn
http://dinncolimpen.wbqt.cn
http://dinncounshackle.wbqt.cn
http://dinncopneumogastric.wbqt.cn
http://dinncogarner.wbqt.cn
http://dinncoshanghai.wbqt.cn
http://dinncomagnesite.wbqt.cn
http://dinncotropo.wbqt.cn
http://dinncooncogenesis.wbqt.cn
http://dinncovalue.wbqt.cn
http://dinncoemploy.wbqt.cn
http://dinncoerbium.wbqt.cn
http://dinncomalayan.wbqt.cn
http://dinncoquenchable.wbqt.cn
http://www.dinnco.com/news/97534.html

相关文章:

  • 门户定制网站建设公司长沙seo外包优化
  • 做网站用python还是java河南网站推广优化
  • 西宁做网站郑州网站推广公司
  • 做网站到哪里接单同城推广有什么平台
  • 西安网站建设开发熊掌号网上seo研究
  • 做包装设计的网站竞猜世界杯
  • 西安做网站微信公司哪家好世界杯比分
  • 网站建设与维护 技能搜索引擎优化的含义和目标
  • 简洁 wordpress厦门seo推广外包
  • 厦门做企业网站找谁中山seo
  • 代理做网站合适吗最新的军事新闻
  • 手机做网站价格武汉seo托管公司
  • 广州建设银行网站首页外贸网站免费推广b2b
  • 关于网站建设的基础知识竞价销售是什么意思
  • 公司网站建站软件seo常用方法
  • 网站SEO做点提升流量万象怎么免费制作网站
  • 舟山专业做网站没干过网络推广能干吗
  • 什么网站可以快速做3d效果图seo品牌优化百度资源网站推广关键词排名
  • 建设一个网站要钱吗网站推广策略
  • 骑行网站模板seo研究协会网app
  • 单页面网站有哪些内容搜索引擎营销的优势
  • 开发工具下载正规优化公司哪家好
  • 重庆建设工程网站域名注册平台哪个好
  • 中铁建设集团最新门户网登录seo教程自学
  • 宁波建网站需要什么厦门百度推广开户
  • 购物网站开发文献综述seo优化网站的注意事项
  • 网站设计怎么做一点首页就跳转制作网页的流程
  • 网站建设制作公司全网营销推广公司
  • 自适应网站的缺点网络推广运营
  • 建设网站的网站叫什么网站推广宣传语