public int Send(OSCPacket packet) { int byteNum = 0; byte[] data = packet.BinaryData; try { byteNum = _udpClient.Send(data, data.Length); } catch {} return byteNum; }
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); }
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); }