如果本地有多个网卡(即多个ip),要指定本地发送网卡,则在建立的socket上bind所指定的网卡进行connect和send操作。例子程序如下:#include #include "WinSock2.h"#pragma comment(lib,"ws2_32.lib")SOCKET tcp_soc...
分类:
其他好文 时间:
2014-06-29 00:05:48
阅读次数:
943
环境Visual Studio 2012,具体代码如下#include #include #include void PrintNumber(int num){ std::cout f_print_num = PrintNumber; f_print_num(1024); // ...
分类:
编程语言 时间:
2014-06-28 14:19:07
阅读次数:
267
环境:一台window客户端192.168.1.100虚拟机上两台centOS:主DNS192.168.1.103从DNS192.168.1.104主DNS服务器一、软件安装查找与bind有关的软件包[root@instructornamed]#yumlistall|grep"^bind"
bind.i68632:9.8.2-0.23.rc1.el6_5.1
bind-libs.i68632:9.8.2-0.23.rc1.el6_5.1
..
分类:
其他好文 时间:
2014-06-24 16:18:56
阅读次数:
268
###How to qulick start Like virtual memory,before closing system,win8 write kernel dialog to a file named hiberfil.sys so ,it just write hiberfil.sy.....
命题 当service经常被远程调用时,我们经常常使用到aidl来定一个接口供service和client来使用,这个事实上就是使用Binder机制的IPC通信。当client bind service成功之后,系统AM会调用回调函数onServiceConnected将service的IBind....
分类:
其他好文 时间:
2014-06-23 00:50:30
阅读次数:
211
服务类
中间人:service服务中的bind对象
创建中间人并通过onBinder方法的return暴露出去
在服务类创建一个服务
创建中间人继承Binder
MainActivity类
声明服务的中间人
private ServiceTese.MyBinder myBinder;
链接成功的时候赋值se...
分类:
其他好文 时间:
2014-06-22 21:36:21
阅读次数:
188
spiral grid
时间限制:2000 ms | 内存限制:65535 KB
难度:4
描述Xiaod has recently discovered the grid named "spiral grid".
Construct the grid like the following figure. (The grid is actually infinite...
分类:
其他好文 时间:
2014-06-22 20:54:07
阅读次数:
185
执行网络I/O,一个进程必须做的第一件事就是调用socket函数,指定期望的通信协议类型。
#include
int socket(int family, int type, int protocol);
/*返回值:若成功则为非负描述符,若出错则为-1*/
socket函数成功时返回一个小的非负整数值,它与文件描述符类似,把它称为套接字描述符,简称sockfd。family参数指明协议...
分类:
其他好文 时间:
2014-06-22 15:40:10
阅读次数:
301
//函数调用 bind&functionvoid fun(){ CCLOG("Hello cocos"); return;}std::function f = std::bind(fun);fun();-------------------void fun1(){ int numb...
分类:
其他好文 时间:
2014-06-21 09:55:02
阅读次数:
166
一.boost::thread的创建 1.线程创建方法一: boost::shared_ptr writeThread_; boost::function0 f = boost::bind(&DBTaskMgr::execute, this); writeThread_ = bo...
分类:
编程语言 时间:
2014-06-18 08:16:15
阅读次数:
283