Problem with UDP

Dec 11, 2007 at 8:12am

Problem with UDP

Hi all,

I am trying to send messages to max by UDP from a C++ program. I tried to send a string from a char buffer[256]. However, I received errors such as :

1) net.recv.udp: OSC packet size(19) not a multiple of 4 bytes: dropping or
2) OSC Bad message name string: DataAfterAlignedString: Unreasonably long sting Dropping entire message.

How can I resolve this error?

Also, is there any other way i can communicate betw. a C++ program and a MAX patch?

I would greatly appreciate some advice. Thanks in advance :P

#34969
Dec 11, 2007 at 10:56am

Hi,

Udp communication in max is based on the OpenSoundControl standard.

http://www.cnmat.berkeley.edu/OpenSoundControl/OSC-spec.html

A tip might be to use the udpsend object to send data to your program and check the received bytes to see how data is formatted by max. Format the data you send to max the same way.

For example if you input a list starting with a symbol to udpsend, you’ll see that the first element is interpreted as osc address, then there is the comma, then the characters indicating the types of the remaining elements of the list, then the remaining elements themselves.

For example if I input “ding ja 45 e”, the bytes look like this:

100 (d) 105 (i) 110 (n) 103 (g)
0 (*) 0 (*) 0 (*) 0 (*)
44 (,) 115 (s) 105 (i) 115 (s)
0 (*) 0 (*) 0 (*) 0 (*)
106 (j) 97 (a) 0 (*) 0 (*)
0 (*) 0 (*) 0 (*) 45 (-)
101 (e) 0 (*) 0 (*) 0 (*)
0 (*) 0 (*) 0 (*) 0 (*)

Note how every argument is padded with zero’s depending on the argument type.

Hth,
Mattijs

#118675
Dec 11, 2007 at 7:25pm

Quote: tiutababo wrote on Tue, 11 December 2007 00:12
—————————————————-
> Hi all,
>
> I am trying to send messages to max by UDP from a C++ program. I tried to send a string from a char buffer[256]. However, I received errors such as :
>
> 1) net.recv.udp: OSC packet size(19) not a multiple of 4 bytes: dropping or
> 2) OSC Bad message name string: DataAfterAlignedString: Unreasonably long sting Dropping entire message.
>
> How can I resolve this error?
>
> Also, is there any other way i can communicate betw. a C++ program and a MAX patch?
>
> I would greatly appreciate some advice. Thanks in advance :P
—————————————————-

Ross Bencina has made an implementation of OSC in C++ here:

http://www.audiomulch.com/~rossb/code/oscpack/

mz

#118676
Dec 12, 2007 at 5:10am

Thanks for your replies.

I’ve tried udpsend using max. However, it seems to work fine… returning just a string on C++ instead of the OSC format. strange…

#118677
Dec 12, 2007 at 5:11am

http://www.audiomulch.com/~rossb/code/oscpack/

I’ve tried to compile this in visual C++ 6.0. However, i keep getting errors.

#118678
Dec 12, 2007 at 9:18am

btw, I’m moving this topic to the dev forum

#118679

You must be logged in to reply to this topic.