随笔分类 -  [C/C++]

摘要:epoll的限制不在于FD_MAXSIZE,而是每个进程所可以打开的最大IO文件描述符。使用root权限执行修改系统设置#设置进程允许打开最大文件描述符 echo "ulimit -n 40960" >> /etc/profile . /etc/profile#设置TCP协议栈未完成连接队列长度echo "40960" > /proc/sys/net/ipv4/tcp_max_syn_backlog#设置TCP协议栈三次握手连接完成队列长度echo "10240" > /proc/sys/net/core/so 阅读全文
posted @ 2013-05-16 11:10 gmark 阅读(495) 评论(0) 推荐(0)
摘要:在C++中用到map时,如果KEY是自定义的struct,那么需要自己定义比较函数。因为只有基本类型有默认的比较方法。定义的方法有两种,一是在作为key的struct中,重载操作符less(<),二是自定义仿函数作为map的比较函数,个人比较喜欢第二种方法。//自定义map的keytypedef struct UrlKey{ uint64_t dwBussID; uint64_t dwVersion; uint64_t dwHashUrl;}UrlKey;//自定义map的valuetypedef struct UrlValue{ string strUrl;}UrlValue;//ma 阅读全文
posted @ 2012-12-18 11:08 gmark 阅读(19145) 评论(1) 推荐(1)