layout: post
title: 鸿蒙假期3
categories: 日志
tags:
- 日志
- 大二
- 大二寒假日志
BGImage: 'https://github.xutongxin.me/https://raw.githubusercontent.com/xutongxin1/PictureBed/master/img0/20220310123346.png'
jekyll-theme-WuK:
musicid: '34367899'
三端通信
新的一年到来了虽然年初一就开始生病了几天
这周的三端通信推进并不算很顺利
编译多线程程序出错
/root/xtx/main.c:145: undefined reference to `pthread_create'
/usr/bin/ld: /root/xtx/main.c:146: undefined reference to `pthread_detach'
不是库的问题,编译的指令要加一句-pthread
即
gcc -pthread -o term term.c
https://stackoverflow.com/questions/1662909/undefined-reference-to-pthread-create-in-linux
please specify the midebuggerpath option
新买的服务器,没有gdb?apt走起
apt update
apt install gdb
undefined reference to `crypt'
也不是库的问题,编译的指令要加一句
-lcrypt
mysql搭配phpmyadmin图形化
mysql图形化牛逼
https://blog.csdn.net/RBPicsdn/article/details/85176646
sudo apt install phpmyadmin
可以直接apt,会解决阿帕奇依赖
然后是ssh隧道穿透,否则80无法访问
简答解析嘉誉师兄的代码,是这样的逻辑
server构造函数启动socket服务器(Server::Server)-》绑定当connect时的逻辑为listener_cb函数-》接收的客户端连入,新建一个线程运行client_handler函数-》绑定当客户端发来信息时执行read_cb函数-》收到客户端的信息,根据json中的cmd指令决定进入server_register函数还是server_login函数。
数据库的层:数据库(excel文件)-》表(excel左下角的表)-》字段(相当于键,或者表头)-》值(相当于键值)
server_register函数-》使用my_database_user_password函数操作数据库-》my_database_connect连接到数据库-》新增一个以用户名为名字的表-》新增一个password字段,并放入一个以密码作为值的键值。
原本:server_login函数-》使用my_database_user_exist函数操作数据库-》my_database_connect连接到数据库-》使用sql命令检查是否存在一个和用户名相同的表 (后面为改动后)-》使用SQL命令查询password的值-》检查值是否与密码一致