08 2022 档案

摘要:1.在服务器端开启远程访问 grant all privileges on *.* to 'root'@'%' identified by 'password';flush privileges; password:可任意设置 2.查看是否已开启 select * from mysql.user w 阅读全文
posted @ 2022-08-26 11:18 *^VV^* 阅读(913) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h>#include <stdlib.h>#include <mysql.h>#include <unistd.h>#include <string.h> int main(){ MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row; 阅读全文
posted @ 2022-08-25 21:25 *^VV^* 阅读(15) 评论(0) 推荐(0) 编辑
摘要:1、创建数据库 CREATE DATABASE test; use test; 2、创建student数据表 CREATE TABLE student -> ( -> id INT(11), -> name VARCHAR(25), -> math INT(3), -> chinese INT(3) 阅读全文
posted @ 2022-08-25 16:44 *^VV^* 阅读(228) 评论(0) 推荐(0) 编辑
摘要:1、初始化一个MYSQL结构 MYSQL *mysql_init(MYSQL *mysql) 2、关闭一个服务器连接,并释放与连接相关的内存 void mysql_close(MYSQL *mysql); 3、连接一个MySQL服务器 MYSQL *mysql_real_connect(MYSQL 阅读全文
posted @ 2022-08-25 15:48 *^VV^* 阅读(47) 评论(0) 推荐(0) 编辑
摘要:1、安装mysql服务器及客户端 sudo apt-get install mysql-server mysql-client 2、安装mysql C语言接口 sudo apt-get install libmysql++-dev 3、编译文件(mysql_config) #mysql_config 阅读全文
posted @ 2022-08-25 13:47 *^VV^* 阅读(21) 评论(0) 推荐(0) 编辑
摘要:动态多进程池实现NTP服务器 服务端:server.c #include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/socket.h>#include <signal.h>#include <arpa/inet.h 阅读全文
posted @ 2022-08-12 15:34 *^VV^* 阅读(52) 评论(0) 推荐(0) 编辑
摘要:通过UDP协议实现简单的停等式FTP文件传输。 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define FTPPORT "8888" //通讯端口#define PATHSIZE 256#define UDPSIZE 512 enum m 阅读全文
posted @ 2022-08-12 08:49 *^VV^* 阅读(191) 评论(0) 推荐(0) 编辑
摘要:通过静态进程池实现NTP服务器 例程:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/wait.h># 阅读全文
posted @ 2022-08-12 08:14 *^VV^* 阅读(31) 评论(0) 推荐(0) 编辑
摘要:多线程实现NTP服务器 服务器端:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/socket.h># 阅读全文
posted @ 2022-08-10 11:32 *^VV^* 阅读(50) 评论(0) 推荐(0) 编辑
摘要:多进程实现NTP服务器 服务器端:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/socket.h># 阅读全文
posted @ 2022-08-10 11:26 *^VV^* 阅读(18) 评论(0) 推荐(0) 编辑
摘要:通过TCP实现NTP服务器 头文件:proto.h #ifndef __PRTOO_H__#define __PRTOO_H__ #define PORT "8888" //服务器端口#define FMT "%lld\r\n" //输出格式 #endif 服务器端:server.c #includ 阅读全文
posted @ 2022-08-10 11:17 *^VV^* 阅读(283) 评论(0) 推荐(0) 编辑
摘要:通过UDP实现局域网多播、组播 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define BORDCAST "224.2.2.2" //定义组播IP地址#define PORT "10001" //组播端口#define NAMESIZE 阅读全文
posted @ 2022-08-10 08:39 *^VV^* 阅读(494) 评论(0) 推荐(0) 编辑
摘要:通过UDP实现两个不同进程间的通讯 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define PORT "5050" //端口#define NAMESIZE 11 struct student_st //自定义传输数据类型{ uint8_ 阅读全文
posted @ 2022-08-08 08:24 *^VV^* 阅读(117) 评论(0) 推荐(0) 编辑
摘要:通过信号量与共享内存实现不同进程间通讯 头文件:myshm.h #ifndef __MYSHM_H__#define __MYSHM_H__ #define KEYPATH "/etc"#define SEMPRJ 'a'#define SHMPRJ 'b'#define NAMESIZE 1024 阅读全文
posted @ 2022-08-05 09:50 *^VV^* 阅读(48) 评论(0) 推荐(0) 编辑
摘要:多线程间通过信号量通讯 int semget(key_t key, int nsems, int semflg); int semop(int semid, struct sembuf *sops, size_t nsops); int semctl(int semid, int semnum, i 阅读全文
posted @ 2022-08-05 08:23 *^VV^* 阅读(35) 评论(0) 推荐(0) 编辑
摘要:多进程间通过消息队列通讯简单示例 头文件:proto.h #ifndef __PROTO_H__ #define __PROTO_H__ #define KEYPATH "/etc/services" #define KEYID 'a'#define NAMESIZE 1024 struct stu 阅读全文
posted @ 2022-08-03 10:05 *^VV^* 阅读(62) 评论(0) 推荐(0) 编辑
摘要:伪代码实现通过匿名管道播放网络视频、音乐等。 示例:player.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h>#include <fcn 阅读全文
posted @ 2022-08-03 08:18 *^VV^* 阅读(32) 评论(0) 推荐(0) 编辑
摘要:父子进程匿名管道通讯 示例:pipe.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h> #define BUFFSIZE 1024 int 阅读全文
posted @ 2022-08-03 08:07 *^VV^* 阅读(15) 评论(0) 推荐(0) 编辑
摘要:通过多线程实现管道通讯 头文件:mypipe.h #ifndef __PIPE_H__#define __PIPE_H__ #define PIPE_RD 0x00000001UL //只读属性#define PIPE_WR 0x00000002UL //只写属性#define MAXLENTH 1 阅读全文
posted @ 2022-08-02 14:41 *^VV^* 阅读(102) 评论(0) 推荐(0) 编辑
摘要:文件锁 int lockf(int fd, int cmd, off_t len); int flock(int fd, int operation); int fcntl(int fd, int cmd, ... /* arg */ ); 例程:lockf.c #include <stdio.h> 阅读全文
posted @ 2022-08-01 09:01 *^VV^* 阅读(83) 评论(0) 推荐(0) 编辑
摘要:使用mmap创建进程间共享内存 例程:shm.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include 阅读全文
posted @ 2022-08-01 08:51 *^VV^* 阅读(101) 评论(0) 推荐(0) 编辑
摘要:数据中继epoll模型 示例:relay_epoll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include < 阅读全文
posted @ 2022-08-01 08:41 *^VV^* 阅读(31) 评论(0) 推荐(0) 编辑
摘要:数据中继poll模型 示例:relay_poll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include <po 阅读全文
posted @ 2022-08-01 08:21 *^VV^* 阅读(34) 评论(0) 推荐(0) 编辑