Sending raw UDP packets to lighting program

Mar 15, 2012 at 8:46am

Sending raw UDP packets to lighting program

So i’m quite new to max and have been trying to trigger a lighting program that takes simple string commands (example. Y”hello world”,10,13) over ethernet. Sadly I haven’t been given much to work on in the company’s forum. The packets are UDP/IP based and should go to port 6553 in broadcast mode.

The structure of the UDP/IP packets are:
long32 chamsys;
word16 version;
byte seq_fwd;
byte seq_bkwd;
word16 length;
byte data;

where long32 is 4 bytes, word16 is 2 bytes and byte is 1 byte.

I figured the aka.datagram might be the way of doing this but I was unable to get the lighting program to respond to any of the values or strings (be they in hex or ascii). Being quite a newbie i figure i must be missing the proper steps to create the packet correctly. Any help, guidance or ideas would greatly be appreciated.

#62279
Mar 15, 2012 at 9:10am

Ah, another MagicQ user! I’ve actually written a couple of abstractions to deal with this :)

http://digitalfx.me.uk/max/CREP.zip

Hope it’s self explanatory.

#224999
Mar 15, 2012 at 10:29am

Thank you for the quick reply! It looks great, i’m new to programming in general(just completing my first programming class) as I study theatre, but i’m able to grasp everything. Thank you! Its become apparent i wouldn’t of been able to blindly do this without your very generous help! I’m excited to test this tomorrow!

#225001
Mar 15, 2012 at 10:31am

Hi,

did you try the networking objects in my library? Namely, [sadam.udpSender] and [sadam.udpReceiver]. You can send/receive raw binary streams with them (so, you just have to send your data from byte to byte to the object and when you bang it, it would send the packeted stream to the specified network address — no additional formatting like OSC or anything else would be performed).

You can access it here: http://www.sadam.hu/software

Hope that helps,
Ádám

#225002
Mar 15, 2012 at 10:55am

Thanks for the heads up Siska Ádám, I ran across your library just after posting. I’m in north america and didn’t expect any replies until much later (3AM now). DiGiTaLFX looks to have given me an excellent solution but I think your right in that [sadam.udpSender] is one of the tools that could handle this. I’m excited to checkout all the other goodies that also reside within your library.

#225003

You must be logged in to reply to this topic.