10月 132009
 

我是经常使用nc来查看mc的状态的,突然有一天,我使用nc命令做set操作,发现总是失败;用telnet没有问题,至少应该不是memcached的问题,可能是nc的问题吧。

今天又遇到了这个问题,我使用tcpdump观察使用nc和使用telnet的差别,发现nc发送的回车为\n ,而telnet发送的回车符为\r\n,差异就这么多了,于是使用下列命令测试:

echo -e "set a 0 0 1\r\na\r\nquit\r\n"|nc host port
结果成功

echo -e "set a 0 0 1\na\nquit\n"|nc host port
结果失败

比较久可以知道问题是出现在回车符上了,至于memcached是怎么解释的,有时间在了解一下源码吧

 Posted by at 上午 12:14

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据