03 2014 档案
摘要:现看看效果如何:方法如下:定义相关颜色的宏 1 #define ESC_START "\033[" 2 #define ESC_END "\033[0m" 3 #define COLOR_FATAL "31;40;5m" 4 #define COLOR_ALERT...
阅读全文
摘要:zlog简述:log是一个高性能、线程安全、灵活、概念清晰的纯C日志函数库。事实上,在C的世界里面没有特别好的日志函数库(就像JAVA里面的的log4j,或者C++的log4cxx)。C程序员都喜欢用自己的轮子。printf就是个挺好的轮子,但没办法通过配置改变日志的格式或者输出文件。syslog是...
阅读全文
摘要:1.添加一个socket任务1 envir().taskScheduler().setBackgroundHandling(socketNum, SOCKET_WRITABLE|SOCKET_EXCEPTION,2 (TaskScheduler::BackgroundHandlerProc*)&connectionHandler, this);2.接下来就会把相关参数设置进socket任务集合中去,接下来就是等待任务调度。 fHandlers->assignHandler(socketNum, conditionSet, ha...
阅读全文
摘要:live555 中存在这5个最基本的类。每个类中都拥有一个BasicUsageEnvironment。这是这几个类之间的相互关系。 MediaSession可以拥有多个subsession。
阅读全文
摘要:使用到主要函数有:#include int epoll_create(int size);int epoll_create1(int flags);int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);typedef union epoll_data { void *ptr; int fd; uint32_t u32; uint64_t u64;}...
阅读全文
摘要:1 #define POLL_FD_SIZE 1024 2 int doServicePoll(int listenFd) 3 { 4 struct sockaddr_in cliAddr; 5 socklen_t len; 6 7 int i; 8 struct pollfd pollFdSet[POLL_FD_SIZE]; 9 for(i = 0 ; i fdNum) {41 fdNum = i;42 }43 ...
阅读全文
摘要:.tar解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileName.tar.gz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName———————————————.bz2解压1:bzip2 -d FileName.bz2解压2:bunzip2 FileName.bz2压缩: bzip2
阅读全文
摘要://read操作加上超时时间。 1 int read_timeout(int fd, void *buf, uint32_t count, int time) 2 { 3 if(time > 0) { 4 fd_set rSet; 5 FD_ZERO(&rSet); 6 FD_SET(fd, &rSet); 7 8 struct timeval timeout; 9 memset(&timeout, 0, sizeof(timeout));10 timeout.tv_sec = time;...
阅读全文

浙公网安备 33010602011771号