udpreceive error sending dictionary to build collective. unable reference dict

michel8's icon

I try to send dictionary through udpsend in Max 7 and receive it with udpreceive in Max 6 or in a build collective Max 7
This gives the following error message: dict.unpack: unable to reference dictionary named xxxx

No error appears if the udpsend and udpreceive is in the same build collective patch or native Max 6 or 7. So it seems the problem appears only if sending to an different application.

Any idea?
I necessarily need to split it in two application.
Thanks!

Max Patch
Copy patch and select New From Clipboard in Max.

Sending patch:

Max Patch
Copy patch and select New From Clipboard in Max.

Receiving patch, make build collective out of it:

michel8's icon

No one have a idea to get rid of the "unable to reference dictionary named xxxx" ?
It also didn't work with simple small dicts. Hope find a solution to send dict over network!

I try a solution with dict.serialize and dict.deserialize, but then the Max crashs.

I find a solution, but not over network, so only at the same computer. I export the dict as a jason file and import it in the build collective.

Thanks for help!

Nikolas K's icon

HI michel8,

The message you send over UDP is something like "dictionary u084002839". Within a Max instance, the dictionaries have a unique name (unless you name them yourself to refer to the same dict), that has a name like the one in the message so the dictionaries know where to refer to when receiving it.
The problem occurs because the second Max instance doesn't "know" which that named dictionary is, as within its memory there is no dictionary named that way, and if it was it would be a different one, it just gets a name - not the data from the dictionary.
As for a solution, can find any obvious one. You could try iterating the dictionary in the first patch, and sending plain values through upd.

-N

Nikolas K's icon
Max Patch
Copy patch and select New From Clipboard in Max.

You can use the [dict.serialize] and [dict.desierialize] to pass the dictionary with th udp:
Send patch:

Max Patch
Copy patch and select New From Clipboard in Max.

Receive Patch:

Hope it helps!
-N

michel8's icon

Thanks Nikolas!

It works now only passably with dict.serialize. I f oversaw the attribute compress 1.

But still, if I change the qmetro to 10ms and the speedlim to 500, the animation starts to stuck each 500ms. It seems that the dict.serialize braking some resources. When I turn off collision its more fluidly.

May I have to stay with the version to save the dict in a json file. May load this jason in a build collective and there dict.serialize and sent it over UDP. This could be a solution to let run the animation smoothly.

Max Patch
Copy patch and select New From Clipboard in Max.

`