func (this *RemoteMessageClient) SendMessage(cmd int, params map[string]string) string { url := "http://" + this.Ip + ":" + dataConvert.IntToStr(this.Port) + "/?" + "cmd=" + dataConvert.IntToStr(cmd) for key, value := range params { paramInfo := "&" + key + "=" + value url += paramInfo } response, err := http.Get(url) if nil == err { defer response.Body.Close() body, _ := ioutil.ReadAll(response.Body) return string(body) } return "error" }
func (this *RemoteMessageServer) Run() { web.Get("/(.*)", this.remoteMessageProc) serverStr := this.Ip + ":" + dataConvert.IntToStr(this.Port) web.Run(serverStr) }