localhostmemcachedtcpclientreadline

Memcache SET command does not work on localhost but from remote machine


I developed a basic memcache get and set implementation in c#.

When i run a test, everything works as expected, when the test is run on another machine than the memcache server.

When i run the same test with memcache server = localhost, suddenly set commands do not work.

I investigated the issue and found, that the memcache server does not respons ANYTHING after i have written:

set mykey 0 0 18\r\n

638555735305882673\r\n

After this Writelines to the socket, the memcached server should send a repsonse line, but he doesn't when i use localhost as server, but does respond STORED when i run the same thing from a remote machine.

I also investigated, that GET commands work in both scenarios, localhost and remote.


Solution

  • Hm, i changed StreamWriter.WriteLine to StreamWriter.Write("\r\n") and now it works.