SSDB .Net client
ssdb / dotnetssdb Goto Github PK
View Code? Open in Web Editor NEWSSDB .Net client
SSDB .Net client
Hi,
I'd like to know if you are planning on implementing all of the list commands available?
Also complete the Sorted Set commands such as qpush_front, qpush_back.
Thanks
Hi,
I've been working with this C# wrapper and every once in a while I get what seems to be a buffer overflow of some sort.
The error is in len = Int32.Parse(Encoding.Default.GetString(lens));
Every once in a while lens becomes corrupted and the int32.parse throws an exceptions.
The error message you see below is a custom error I'm throwing for debug printing the pos and idx values.
Haven't gotten deep enough with the Link code. Any ideas why this would happen?
Thanks
2016-01-31 23:40:03.1383 TRACE [DownloadBlock()] Error: [SSDB()] Details(pos\idx): 1306858 699409 , at ssdbClient.Link.parse() in D:\Down\dotnetssdb-master\ssdb\ssdb\Link.cs:line 130 at ssdbClient.Link.recv() in D:\Down\dotnetssdb-master\ssdb\ssdb\Link.cs:line 70 at ssdbClient.Link.request(List1 req) in D:\Down\dotnetssdb-master\ssdb\ssdb\Link.cs:line 65 at ssdbClient.Link.request(String cmd, Byte[][] args) in D:\Down\dotnetssdb-master\ssdb\ssdb\Link.cs:line 48 at ssdbClient.SddbClient.request(String cmd, Byte[][] args) in D:\Down\dotnetssdb-master\ssdb\ssdb\SddClient.cs:line 33 at ssdbClient.SddbClient.get(Byte[] key, Byte[]& val) in D:\Down\dotnetssdb-master\ssdb\ssdb\SddClient.cs:line 110
源码中有如下一段:
private byte[] _bytes(string s) {
return Encoding.Default.GetBytes(s);
}
private string _string(byte[] bs) {
return Encoding.Default.GetString(bs);
}
经过测试, 在我的Windows 7系统上, Encoding.Default
的值是DBCSCodePageEncoding
, 在Ubuntu系统上, Encoding.Default
的值是UTF8Encoding
.
首先windows上,那个非常不常见的encoding会导致数据丧失可移植性. 把数据拷贝到其它的系统上多半就不能读取了.
再次在不同的系统之间, Encoding.Default
的值不同, 这会导致基于这个API编写的代码丧失跨平台性.
我个人感觉不妨直接把encoding定死为UTF8Encoding. 这个编码绝大部分情况下是没有问题的. 另外可以给构造函数加个参数, 允许指定编码.
我自己基于这个api改了很多, 有时间我可能会另外创建一个repo公开我的代码. 目前就先提以上意见, 供参考.
感谢开发维护SSDB!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.