发布时间:2013-05-05 10:17:59
版权所有,转载请注明出处。Author: Tony <tingw.liu#gmail.com>今天一个可爱的同事问我同一个socket能否bind多个port?说实话,真没这么玩过。本着严谨的态度,决定研究一下这样是否可以。说明本内容针对的内核版本是SLES 11 SP2 3.0.13-0.27首先分析系统调用函数bind,内核层实现在net/socket.c中:点击.........【阅读全文】
发布时间:2013-05-05 10:16:36
废话少说,上代码!/server.c/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <errno.h>int main(int argc,char *argv[]){ .........【阅读全文】
发布时间:2013-03-05 20:25:11
最近使用sipP要用到单网卡绑定多IP地址,我的系统是Ubuntu12.04,具体配置如下:我的系统只有一个网卡eth0,单网卡绑定多ip需要设置/etc/network/interface文件文件修改前配置如下:# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0if.........【阅读全文】