Linux sockaddr_in赋值
serv_addr.sin_family=AF_INET;
serv_addr.sin_port=htons(SERVPORT);
inet_pton(AF_INET,"127.0.0.1",&serv_addr.sin_addr);
IP地址转换函数有:inet_pton,inet_addr,inet_aton,inet_ntoa,inet_ntop
前三个是将ASCII字符转换成网络字节序;
最后两个是将网络字节序转换成ASCII字符。
现在推荐使用inet_pton,inet_ntop,比较新的处理函数,能够处理ip4与ip6。
字母p和n分别代表:presentation 和numeric。
相关文档:
1,先看看工作队列和tasklet的区别:
(1) 定时器和tasklet:
Tasklets resemble kernel timers in 3 ways.
1)They are always run at interrupt time,
2)they always run on the same CPU that schedules the ......
此处vmware版本为6.5 ,主机为windows xp,vmware 安装了redhat linux
1.网络设置:
打开vmware,点vmware->setting->Hardware->Newwork Adapter->Custom - >
VMnet1(host-only)
查看windows网络连接,看到一个VMnet1的连接,设置它的ip与子网掩码。如:IP:192.168.13.1 ,子网掩码 255.255.255.0 ......
http://www.softhouse.com.cn/linux/knowledge/tech/7320.html
......
#include <fcntl.h>
int main(void)
{
typedef union un{
short s;
char c[sizeof(short)];
}un;
un myun;
myun.s = 0x0102;
......