示例#1
0
 public int Send(OSCPacket packet)
 {
     int byteNum = 0;
     byte[] data = packet.BinaryData;
     try
     {
         byteNum = _udpClient.Send(data, data.Length);
     }
     catch {}
     return byteNum;
 }
示例#2
0
 public OSCPacket Receive()
 {
     try
     {
         IPEndPoint ip    = null;
         byte[]     bytes = _udpClient.Receive(ref ip);
         if (bytes != null && bytes.Length > 0)
         {
             return(OSCPacket.Unpack(bytes));
         }
     }
     catch
     {
         return(null);
     }
     return(null);
 }
示例#3
0
        public static new OSCBundle Unpack(byte[] bytes, ref int start, int end)
        {
            string address = UnpackString(bytes, ref start);

            if (!address.Equals(BUNDLE))
            {
                return(null);
            }

            long      timestamp = UnpackLong(bytes, ref start);
            OSCBundle bundle    = new OSCBundle(timestamp);

            while (start < end)
            {
                int length = UnpackInt(bytes, ref start);
                bundle.Append(OSCPacket.Unpack(bytes, ref start, start + length));
            }

            return(bundle);
        }