摘要:
通过UDP协议实现简单的停等式FTP文件传输。 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define FTPPORT "8888" //通讯端口#define PATHSIZE 256#define UDPSIZE 512 enum m 阅读全文
摘要:
通过静态进程池实现NTP服务器 例程:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/wait.h># 阅读全文
摘要:
多线程实现NTP服务器 服务器端:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/socket.h># 阅读全文
摘要:
多进程实现NTP服务器 服务器端:server.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <arpa/inet.h>#include <sys/types.h>#include <sys/socket.h># 阅读全文
摘要:
通过TCP实现NTP服务器 头文件:proto.h #ifndef __PRTOO_H__#define __PRTOO_H__ #define PORT "8888" //服务器端口#define FMT "%lld\r\n" //输出格式 #endif 服务器端:server.c #includ 阅读全文
摘要:
通过UDP实现局域网多播、组播 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define BORDCAST "224.2.2.2" //定义组播IP地址#define PORT "10001" //组播端口#define NAMESIZE 阅读全文
摘要:
通过UDP实现两个不同进程间的通讯 头文件:proto.h #ifndef __PROTO_H__#define __PROTO_H__ #define PORT "5050" //端口#define NAMESIZE 11 struct student_st //自定义传输数据类型{ uint8_ 阅读全文
摘要:
通过信号量与共享内存实现不同进程间通讯 头文件:myshm.h #ifndef __MYSHM_H__#define __MYSHM_H__ #define KEYPATH "/etc"#define SEMPRJ 'a'#define SHMPRJ 'b'#define NAMESIZE 1024 阅读全文
摘要:
多线程间通过信号量通讯 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 阅读全文
摘要:
多进程间通过消息队列通讯简单示例 头文件:proto.h #ifndef __PROTO_H__ #define __PROTO_H__ #define KEYPATH "/etc/services" #define KEYID 'a'#define NAMESIZE 1024 struct stu 阅读全文