上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 75 下一页
摘要: 1、函数 #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int inet_aton(const char *cp, struct in_addr *inp); in_addr_t inet_addr(const char *cp); in_addr_t ... 阅读全文
posted @ 2011-09-05 14:06 浪里飞 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 方法一:View Code #include <time.h>#include <stdio.h>void main( void ){time_t ltime;time( &ltime );printf( "The time is %s\n", ctime(&ltime ) );}方法二:struct timeval start;struct timeval end;float time_use = 0;gettimeofday(&start,NULL); //do some operationgettimeofday(&am 阅读全文
posted @ 2011-09-04 17:23 浪里飞 阅读(2065) 评论(0) 推荐(0) 编辑
摘要: 1、给string赋char*型值,通过以下方式: 构造函数 string ( const char * s, size_t n ); string ( const char * s ); //要求s指向的C风格的字符串必须以'\0'结尾。 或用assign: string& assign ( const char* s, size_t n ); string& assign ( co... 阅读全文
posted @ 2011-09-04 14:53 浪里飞 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 1、使用printf应当说是类型不安全的。所以才引入了C++的流输入输出。 比如: #include "stdint.h" #include "iostream" using namespace std; int main() { int64_t a = 1; int b = 2; uint32_t uin... 阅读全文
posted @ 2011-09-04 14:16 浪里飞 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 学习写一个最简单的web交互页面,可以向apache传送数据,通过cgi接受,并返回数据。示例代码View Code <input id="my" type="submit" value="submit"/><script type="text/javascript"> $("#my").click(function() { var id1 = document.getElementById('id1').value; $.post("/cgi- 阅读全文
posted @ 2011-09-03 22:34 浪里飞 阅读(588) 评论(0) 推荐(0) 编辑
摘要: 1、协议 语法:通信双方“如何讲” 语义:确定通信双方“讲什么” 时序:通信双方“讲话”的次序 2、TCP与UDP 3、套接字使用地址结构为: sockaddr IP v4地址为: sockaddr_in 4、阻塞与非阻塞 阻塞: 函数不返回,直到发送或接收数据等成功 套接字输出队列满,函数send会阻塞... 阅读全文
posted @ 2011-09-03 21:02 浪里飞 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 一、head与od 1、head -n 18 filename.cpp | tail -n 1 head [OPTION]... [FILE]... //output the first part of files -n, --lines=[-]N print the first N lines instead of the first 10; with the le... 阅读全文
posted @ 2011-09-03 17:19 浪里飞 阅读(264) 评论(0) 推荐(0) 编辑
摘要: scp是 secure copy的缩写, scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令。linux的scp命令可以在linux服务器之间复制文件和目录。1、格式scp [-124rv][-P port] [[user@]host1:]file1 [...] [[user@]host2:]file21,2,3表示使用的ssh协议类型,r为递归复制整个目录,v列出详细1、复制文件scp local_file remote_username@remote_ip:remote_folder如:scp /home//scp.zip root@192.168.0.1:/home/so. 阅读全文
posted @ 2011-09-03 15:55 浪里飞 阅读(277) 评论(0) 推荐(0) 编辑
摘要: epoll是做为一个虚拟文件系统来实现的,这样做至少有以下两个好处: 1、可以在内核里维护一些信息,这些信息在多次epoll_wait间是保持的,比如所有受监控的文件描述符。 2、epoll本身也可以被poll/epoll; 【1】epoll的实现中,所等待的设备就绪后,便调用call_back函数,把该设备加入到就绪队列中,避免了像poll那样设备就绪后再... 阅读全文
posted @ 2011-09-03 13:23 浪里飞 阅读(349) 评论(0) 推荐(0) 编辑
摘要: Q1 What happens if you add the same fd to an epoll_set twice? A1 You will probably get EEXIST. However, it is possible that two threads may add the same fd twice. This is a harmle... 阅读全文
posted @ 2011-09-03 12:35 浪里飞 阅读(528) 评论(0) 推荐(0) 编辑
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 75 下一页