   EthernetClient net_client;
 
   while (0 == net_client.connect(host, port)) {
-    Serial.println("c");
+    Serial.println("cs"); // connect server
     delay(1000);
   }
   delay(100);
 
+  Serial.println("wd"); // write data
+  Serial.println((char *)buf + 3);
   net_client.write(buf, *len);
   net_client.flush();
 
+  Serial.println("ca"); // check available
   while (!net_client.available()) {
-    Serial.println("a");
+    Serial.println(".."); // wait data
     delay(1000);
   }
 
+  Serial.println("rd"); // read data
   *len = net_client.read(buf, BUFSIZE - 1);
   buf[*len] = 0;
 
   net_client.stop();
 }
 
-void simple_send_recv2(uint8_t *buf, uint16_t *len, IPAddress ip, uint16_t port) {
-  EthernetClient net_client;
-
-  while (0 == net_client.connect(ip, port)) {
-    Serial.println("c");
-    delay(1000);
-  }
-  delay(100);
-
-  net_client.write(buf, *len);
-  net_client.flush();
-
-  while (!net_client.available()) {
-    Serial.println("a");
-    delay(1000);
-  }
-
-  *len = net_client.read(buf, BUFSIZE - 1);
-  buf[*len] = 0;
-
-  net_client.stop();
-}
-
 bool get_host_v2(const char *appkey, char *url) {
-  uint8_t buf[BUFSIZE];
+  uint8_t buf[BUFSIZE] = {0};
 
   String data("{\"a\":\"");
   data += String(appkey);

  data += String("\"}");

  Serial.println(data);
  client.publish(g_topic, data.c_str());
}

void messageReceived(String topic, String payload, char *bytes, unsigned int length) {

  char *p = strstr(url, "tcp://");
  if (p) {
    p += 6;
    char *q = strchr(p, ':');
    if (q) {
      int len = strlen(p) - strlen(q);
      if (len > 0) {
        memcpy(addr, p, len);
        *port = atoi(q + 1);
#if 0
        Serial.print("i:");
        Serial.println(addr);
        Serial.print("p:");
        Serial.println(*port);
#endif
        return true;
      }
    }
