// private string msg = "hold"; //默认发送数据 //发送数据 private void sendMsg() { String targetIP = Utils.getConfig("targetIP"); if (targetIP != null && !"".Equals(targetIP)) { try { EndPoint point = new IPEndPoint(IPAddress.Parse(targetIP), 6000); Rehabilitation rhb = Rehabilitation.GetSingleton(); int now = 0; while (isServe) { if (server != null && (now = rhb.GetScore()) != -1) { server.SendTo(Encoding.UTF8.GetBytes(now.ToString()), point); } } } catch (Exception e) { MessageBox.Show(e.ToString(), "出错了"); isServe = false; } } else { MessageBox.Show("目标IP地址不能为空", "出错了"); } }
private void SendQuatToClient() { try { //send right var f_r = dh.GetFrameData(HandType.Right, Definition.MODEL_TYPE); var s = sc.UpdateRaw(f_r); if (s != null) { sm.Send(s.ToJson()); } var score = rhb.GetScore(); if (score != -1) { Console.WriteLine("得分:{0}", score); } ////send left //var f_l = dh.GetFrameData(HandType.Left, Definition.MODEL_TYPE); //s = sc.UpdateRaw(f_l); //if (s != null) //{ // sm.Send(s.ToJson()); //} } catch (Exception e) { Console.WriteLine(e); return; } }
private void SendMsg(object source, ElapsedEventArgs e) { int score = rhb.GetScore(); var f_r = dh.GetFrameData(HandType.Right, Definition.MODEL_TYPE); WebSockData wsd = new WebSockData(); wsd.nodes = f_r.Nodes; wsd.score = score; Send(JsonConvert.SerializeObject(wsd)); }
public void GetScore() { var s = rhb.GetScore(); }