/// <summary> /// Sends the a status response message to the (previously set) receipient /// </summary> /// <param name="message">Message.</param> private void SendStatus(string message) { Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPAddress serverAddr = IPAddress.Parse(hostname); IPEndPoint endPoint = new IPEndPoint(serverAddr, sendPort); byte[] send_buffer = Encoding.ASCII.GetBytes(message); sock.SendTo(send_buffer, endPoint); GuiScript.Log("Sent \"" + message + "\" to " + hostname + ":" + sendPort); }
/// <summary> /// Check if there are messages in the cue. If there are, send them to the FaceAnimator object's /// HandleMessages() function. /// </summary> private void Update() { if (messages.Count > 0) { try { // try block prevents dropping of messages if something goes wrong foreach (string message in messages) { GuiScript.Log(message); FaceAnim.HandleMessage(message); } // clears only if no errors occured messages.Clear(); Debug.Log("Messages cleared"); } catch (Exception e) { Debug.Log(e.Message + ":" + e.StackTrace); } } }