All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.tom.protocol.co.protocol-info.md Maven / Gradle / Ivy

The newest version!
## 自定义 byte 流协议, 参考pgsql数据传输

** @author tomsun * 

** header  see Header.class **

	type[1] +length[4] + id[8]  + compress[1] + ask[1]+ mlength[1] + method[mlength]
		|        |          |         |           |        |             |
	   0xff	            总长度		   序号		 压缩                   请求或回复            方法长度                     方法名称
	
	length+5 = msg.len
	

** filed[]  see Field.class **

	fieldLength[ 
	columnLength[1]|columnName[columnLength]|typeModifier[2]
	columnLength[1]|columnName[columnLength]|typeModifier[2]
	]

	typeModifier 使用 java.sql.Types 对应

** body == Row[cell] see Rows.class ** 
		
		Row.lenth = filed[].length * n 
		
	[	
		len[4]|data[len]
		len[4]|data[len] 
		len[4]|data[len] 
		len[4]|data[len] 
	]
	
	
 
** 初始化例子 **	

		Header header = new Header(id, 0, "getUser");
		
		Field f = new Field("uid", Types.CHAR);
		Field f2 = new Field("name",Types.VARCHAR);
		
		Rows rows = new Rows();
		
		rows.setCell(new Rows.Cell((char)1));
		rows.setCell(new Rows.Cell("潘明光".getBytes()));
		
		rows.setCell(new Rows.Cell((char)2));
		rows.setCell(new Rows.Cell("潘明光2".getBytes()));
		
		Message msg  = new Message();
		msg.setHeader(header);
		
		msg.setFields(f, f2);
		
		msg.setBody(rows);
		msg.initLength();  // 初始化 header.length总长度

*/




© 2015 - 2024 Weber Informatics LLC | Privacy Policy