コード例 #1
0
        public OscClient(string ipAddress, int port)
        {
            m_Writer = new OscWriter();

            m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            if (ipAddress == "255.255.255.255")
            {
                m_Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
            }

            Destination = new IPEndPoint(IPAddress.Parse(ipAddress), port);
            m_Socket.Connect(Destination);
        }
コード例 #2
0
ファイル: OscBundle.cs プロジェクト: tilde-love/osc-core
        public override void Write(OscWriter writer)
        {
            OscTimeTag timestamp = Timestamp;

            writer.StartBundle(BundleIdent, ref timestamp);

            foreach (OscPacket message in this)
            {
                writer.WriteBundleMessageLength(message.SizeInBytes);

                message.Write(writer);
            }
        }
コード例 #3
0
ファイル: OscBundle.cs プロジェクト: tilde-love/osc-core
        /// <summary>
        ///     Send the bundle into a byte array
        /// </summary>
        /// <param name="data">an array ouf bytes to write the bundle into</param>
        /// <param name="index">the index within the array where writing should begin</param>
        /// <returns>the number of bytes in the message</returns>
        public override int Write(byte[] data, int index)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                OscWriter writer = new OscWriter(stream);

                stream.Position = index;

                Write(writer);

                return((int)stream.Position - index);
            }
        }
コード例 #4
0
ファイル: OscPacket.cs プロジェクト: tilde-love/osc-core
 public abstract void Write(OscWriter writer);