handlersocket使用 第七章 Authentication
来源:互联网 发布:大数据时代 txt 完整版 编辑:程序博客网 时间:2024/05/16 07:42
注: 本文档主要根据原作者的英文文档protocol.en.txt写成,做了一些翻译工作和添加了一些例子以及一些需要注意的地方。如果本文档对你有所帮助,欢迎关注我的新浪微博:http://weibo.com/u/1857063732 如果有建议,欢迎发送到我的邮箱xiaoxuye1988@163.com 目前就职于 欢聚时代(YY), 从事于后台开发工作
Authentication
英文原文如下
Authentication
The'auth' request has the following syntax.
A <atyp> <akey>
-<atyp> must be '1'
-An 'auth' request succeeds iff <akey> is the correct secret specified by
the 'handlersocket_plain_secret' or'handlersocket_plain_secret_rw'.
-If an authentication is enabled for a listener, any other requests on a
connection fail before an 'auth' requestsucceeded on the connection.
认证
'auth'请求为以下形式:
A <atyp> <akey>
- <atyp> 必须是 '1'
-一个'auth'请求只有在<akey>和'handlersocket_plain_secret' 或'handlersocket_plain_secret_rw'指定的密码一致才能执行成功。
-如果对于一个监听的(服务)进程启动了认证,那么在这个连接上,在 'auth'请求成功执行之前任何其他请求都会失败。
Responsefor 'auth'
If'auth' is succeeded, HanderSocket returns a line of the following syntax.
0 1
'auth'请求的回应:
如果'auth'请求成功发送,HanderSocket 会返回0或1.
在哪里设置查看'handlersocket_plain_secret' 和'handlersocket_plain_secret_wr'?
一般在/etc/mysql/my.cnf中。
所使用的成员函数的原型:
virtual void request_buf_auth(const char *secret, const char *typ) =0;
举个简单例子:
cli->request_buf_auth("1234","1"); //第二个参数必须是"1"
do { //发送request_buf_open_index请求
if (cli->request_send()!= 0) {
fprintf(stderr, "request_send:%s\n", cli->get_error().c_str());
break;
}
if ((code =cli->response_recv(numflds)) != 0) {
fprintf(stderr, "response_recv:%s\n", cli->get_error().c_str());
break;
}
} while (false);
cli->response_buf_remove();
注意hstcpcli_ptr cli所使用的端口和对应的密码要和my.cnf配置文件中对应。
- handlersocket使用 第七章 Authentication
- handlersocket使用
- handlersocket使用 第二章 请求和回应
- handlersocket使用 第三章 Opening index
- handlersocket使用 第四章 Getting data
- handlersocket使用 第五章 Updating/Deleting data
- handlersocket使用 第六章 Inserting data
- HandlerSocket简介以及php使用handlersocket
- HandlerSocket使用经验
- MYSQL插件Handlersocket使用
- HandlerSocket
- HandlerSocket
- HandlerSocket!
- HandlerSocket
- XFire 中使用 Authentication
- handlersocket使用 第一章 基本语法和一个简单示例
- NoSQL for MySQL [HandlerSocket] 之安装与使用
- php-handlersocket
- 设计师需要的知识体系
- DownloadManager
- c++ struct new
- Message Queue和handle
- 什么是 Enterprise JavaBeans 组件?
- handlersocket使用 第七章 Authentication
- OA_设计
- mybatis 批量插入
- Busybox1.13.3制作yaffs2根文件系统(静态和动态)
- 关于TXT转CHM的完整解决方案
- Intel PC的相关信息
- MyBatis框架的使用
- C语言宏的妙用
- 简要说明如何使用批处理中的变量