2012年7月25日
摘要: ioctlsocket is short for io control socket,也就是指示SOCKET的IO mode.可以为阻塞或者非阻塞.以下代码copy from MSDN。代码中iMode参数指示了阻塞或者非阻塞的模式。===================================================================================================================================================#include <winsock2.h>#include 阅读全文
posted @ 2012-07-25 17:28 kkmm 阅读(3547) 评论(0) 推荐(1) 编辑
摘要: rup wrote:> What is the meaning of these keywords used before variables in a> function parameters?> > __in> __out> __in_opt> These are Microsoft extensions that annotate the parameters for__in: input parameter__out output parameter__in_opt: optional input parameter 阅读全文
posted @ 2012-07-25 17:21 kkmm 阅读(420) 评论(0) 推荐(0) 编辑
摘要: __w64Visual Studio 2010Other Versions0 out of 1 rated this helpful-Rate this topic(Microsoft Specific) Lets you mark variables, such that when you compile with/Wp64the compiler will report any warnings that would be reported if you were compiling with a 64-bit compiler.type __w64 identifierParameter 阅读全文
posted @ 2012-07-25 16:40 kkmm 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 在对IP地址结构体SOCKADDR_IN赋值的时候,经常会用到下列的函数htonl,htons,inet_addr,与之相对应的函数是ntohl,ntohs,inet_ntoa。查看这些函数的解析,会发现这些函数其实是与主机字节序和网络字节序之间转换有关。就是什么网络字节序,什么是主机字节序呢?下面我写出他们之间的转换:用IP地址127.0.0.1为例:第一步 127 . 0 . 0 . 1 把IP地址每一部分转换为8位的二进制数。第二步 01111111 00000000 00000000 00000001 = 2130706433(主机字节序)然后把上面的四部分二进制数从右往左按部分重新排 阅读全文
posted @ 2012-07-25 16:27 kkmm 阅读(325) 评论(0) 推荐(0) 编辑