UDP Networking to non-Max Peer
So I wasn’t holding my breath for a Windows version of Mira, but funnily enough, this was just announced in beta. (No WinRT version yet though.) My goal is to get remote UI running on my Surface RT with a UDP connection to Max running on my laptop. Seems like a pretty straightforward thing to build.
I started with this sample here: http://code.msdn.microsoft.com/windowsapps/DatagramSocket-sample-76a7d82b which lets you bind to a UDP port on a remote machine and send to or listen to it.
I fire up Max and put a simple patcher together with some udpreceive and udpsend objects. This communicates fine with a similar patcher on another machine, so I know it’s not a firewall issue. But I can’t seem to get it to talk to my C# app. The C# app can receive its own echos. I set a breakpoint on the MessageReceived() callback and that fires when the app sends a message, but nothing happens when Max sends on the same port.
What am I missing here?
Maybe there is a binding conflict.
Keep in mind that different apps cannot be bound to the same UDP port.
my guess is that you’re not sending OSC-formatted messages (which is what udpsend/udpreceive expects). To confirm this, I’d either send OSC messages from C# and see what happens, or replace [udpreceive] with [sadam.udpReceiver], which will catch any UDP message and interpret it as a stream of bytes (numbers from 0 to 255).
Thanks for the responses. Binding conflict may very well be it – I was doing some testing against localhost, but the problem still exists on two separate computers with a single binding to send/receive ports.
I am aware of the OSC-formatting, and in my test app I was sending what I thought was a properly formed OSC message, but I may have made a mistake.
I’m also going to try NetMon to see what the traffic looks like.
Got this to work. I was missing a call to DataWriter::StoreAsync() to commit the buffer.
FTR, there are some rules around using UDP sockets on localhost/127.0.0.1 across a modern app boundary, even with network capabilities in place. During debugging, there is a checkbox to enable this under project properties on the Debug tab.
Forums > MaxMSP