/// <summary>
        /// Writes a single packet to the stream at the current position.
        /// </summary>
        /// <param name="packet">A osc packet</param>
        public void Write(OscPacket packet)
        {
            if (Format == OscPacketFormat.Binary)
            {
                byte[] bytes = packet.ToByteArray();

                // write the length
                Helper.Write(m_BinaryWriter, bytes.Length);

                // write the packet
                m_BinaryWriter.Write(bytes);
            }
            else
            {
                // write as a string
                m_StringWriter.WriteLine(packet.ToString());
            }
        }
 /// <summary>
 /// Invoke a osc packet
 /// </summary>
 /// <param name="packet">the packet</param>
 /// <returns>true if any thing was invoked</returns>
 public bool Invoke(OscPacket packet)
 {
     if (packet is OscMessage)
     {
         return(Invoke(packet as OscMessage));
     }
     else if (packet is OscBundle)
     {
         return(Invoke(packet as OscBundle));
     }
     else
     {
         throw new Exception(String.Format(Strings.Listener_UnknownOscPacketType, packet.ToString()));
     }
 }