This commit is contained in:
wentch
2016-01-21 11:03:43 +08:00
parent 5a61b5122f
commit 63f9cb4a15
2 changed files with 3 additions and 3 deletions

View File

@@ -421,7 +421,7 @@
</pre></div>
<br/>
<h3><a id="convert_bson_buffer" class="anchor" href="#" aria-hidden="true"><span class="octicon octicon-link"></span></a>BSON的协议格式</h3>
<h3><a id="convert_bson_struct" class="anchor" href="#" aria-hidden="true"><span class="octicon octicon-link"></span></a>BSON的协议格式</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BSON类似Java自带的Serializable 其格式如下: <br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1). 基本数据类型: 直接转换成byte[] <br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2). SmallString(无特殊字符且长度小于256的字符串): length(1 byte) + byte[](utf8); 通常用于类名、字段名、枚举。 <br/>

View File

@@ -642,7 +642,7 @@
<h3><a id="net_sncp" class="anchor" href="#" aria-hidden="true"><span class="octicon octicon-link"></span></a>SNCP 协议</h3>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SNCP(Service Node Communicate Protocol)协议是RedKale独有的一种传输协议用于进程之间的通信即请求方的<a href="service.html#service_remote" target="_blank">远程模式Service</a>与响应方的Service之间的通信。可以看成是RMI(远程接口调用)的同款主要区别在于RedKale里SNCP几乎是透明的写一个普通的Service通过配置即可实现远程调用而不需要专门针对远程写接口。SNCP服务的配置与HTTP差不多只是SNCP不需要ServletSncpServlet是通过Service动态生成的。<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SNCP的数据包分包头和包体。包头描述请求的Service信息请求包的包体描述参数的BSON响应包的包体描述回调的参数对象和结果对象的BSON<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SNCP的数据包分包头和包体。包头描述请求的Service信息请求包的包体描述参数的<a href="convert.html#convert_bson_struct" target="_blank">BSON值</a>,响应包的包体描述回调的参数对象和结果对象的<a href="convert.html#convert_bson_struct" target="_blank">BSON值</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;包头固定长度为72字节其结构如下:
</p>
<table style="margin: auto;">
@@ -657,7 +657,7 @@
<tr><td>结果码</td><td style="text-align: center;">4</td><td>请求方的值固定为0响应方的值视为错误码为0表示成功非0为失败。</td></tr>
</table>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;包体数据结构为 ([参数序号][参数BSON值])* N + [0][结果对象BSON]。 其中参数序号从1开始只有当Service的方法存在<a href="service.html#service_dyncall" target="_blank">@DynCall回调</a>才会有参数BSON序号为0表示为结果对象的BSON值。若方法为<font color="blue">void</font>返回类型则不存在结果对象BSON值
&nbsp;&nbsp;&nbsp;&nbsp;包体数据结构为 ([参数序号][参数BSON值])* N + [0][结果对象BSON]。 其中参数序号从1开始只有当Service的方法存在<a href="service.html#service_dyncall" target="_blank">@DynCall回调</a>才会有参数<a href="convert.html#convert_bson_struct" target="_blank">BSON值</a>序号为0表示为结果对象的<a href="convert.html#convert_bson_struct" target="_blank">BSON值</a>。若方法为<font color="blue">void</font>返回类型,则不存在结果对象<a href="convert.html#convert_bson_struct" target="_blank">BSON值</a>
</p>
<h3><a id="net_diy" class="anchor" href="#" aria-hidden="true"><span class="octicon octicon-link"></span></a>自定义协议</h3>