public void Send(OSCPacket packet, string hostname, int port) { if (isrunning) { byte[] data = packet.BinaryData; udpsender.Send (data, data.Length, hostname, port); } }
public void Send(OSCPacket packet, IPEndPoint endPoint) { if(isrunning) { byte[] data = packet.BinaryData; udpsender.Send(data, data.Length, endPoint); } }
public static new OSCBundle Unpack(byte[] bytes, ref int start, int end) { string address = unpackString(bytes, ref start); //Console.WriteLine("bundle: " + address); if (!address.Equals(BUNDLE)) { return(null); // TODO } long timestamp = unpackLong(bytes, ref start); OSCBundle bundle = new OSCBundle(timestamp); while (start < end) { int length = unpackInt(bytes, ref start); int sub_end = start + length; //Console.WriteLine(bytes.Length +" "+ start+" "+length+" "+sub_end); bundle.Append(OSCPacket.Unpack(bytes, ref start, sub_end)); } return(bundle); }
public byte[] GetBytes(OSCPacket packet) { if (buffer == null) { buffer = new ProtocolBuffer(); } else { buffer.Flush(); } PacketAdd(packet.Address); if (packet.ArgList != "") { PacketAdd(packet.ArgList); foreach (var arg in packet.Arguments) { if (arg is OSCStringArg) { PacketAdd(((OSCStringArg)arg).value); } if (arg is OSCIntArg) { PacketAdd(((OSCIntArg)arg).value); } if (arg is OSCFloatArg) { PacketAdd(((OSCFloatArg)arg).value); } if (arg is OSCBlobArg) { PacketAdd(((OSCBlobArg)arg).value); } } } return(buffer.ToArray()); }
private List <IOSCArgument> PacketParseArguments(OSCPacket packet, ref int offset, byte[] bytes) { int arg_offset = 1; // skip comma List <IOSCArgument> args = new List <IOSCArgument>(); if (packet.ArgList != null) { while (arg_offset < packet.ArgList.Length) { switch (packet.ArgList[arg_offset]) { case OSCString: args.Add(AddStringArgument(ref offset, bytes)); break; case OSCInt: args.Add(AddIntArgument(ref offset, bytes)); break; case OSCFloat: args.Add(AddFloatArgument(ref offset, bytes)); break; case OSCBlob: args.Add(AddBlobArgument(ref offset, bytes)); break; default: throw new NotImplementedException(); } arg_offset++; } } return(args); }
public void SendPacket(OSCPacket packet, string hostname, int port) { server.Send(packet, hostname, port); }
public void SendPacket(OSCPacket packet, System.Net.IPEndPoint endPoint) { server.Send(packet, endPoint); }
public void SendOSCMessage(OSCPacket packet) { oscManager.SendPacket(packet, sendEndPort); }