Ejemplo n.º 1
0
        public void Put(string key, string value)
        {
            TcpCommLib.Client  client  = new TcpCommLib.Client(hostname, port);
            TcpCommLib.Message message = new TcpCommLib.Message();

            message.Values["method"] = "put";
            message.Values["key"]    = key;
            message.Values["value"]  = value;

            TcpCommLib.Message reply = client.SendMessage(message);

            if (!string.IsNullOrEmpty(reply.Values["exception"]))
            {
                throw new Exception(reply.Values["exception"]);
            }
        }
Ejemplo n.º 2
0
        public string Get(string key)
        {
            TcpCommLib.Client  client  = new TcpCommLib.Client(hostname, port);
            TcpCommLib.Message message = new TcpCommLib.Message();

            message.Values["method"] = "get";
            message.Values["key"]    = key;

            TcpCommLib.Message reply = client.SendMessage(message);

            if (!string.IsNullOrEmpty(reply.Values["exception"]))
            {
                throw new Exception(reply.Values["exception"]);
            }

            return(reply.Values["value"]);
        }