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); }
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); } }
/// <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); } }
public abstract void Write(OscWriter writer);