Forum

You must be logged in to post Login


Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

Max UDPSEND causes crash in client recieve

No Tags
UserPost

11:44 pm
December 12, 2010


Brett

Guest

Hello,

I am using Max from Cycling74 along with Live and MaxForLive on a project. 
In this project I'm looking to send some data from the MaxForLive object (via Max udpsend).
In do a udpsend of any value or string such as 12 or "test" I get the following error.
If I put together a packet like "/test/test" nothing shows up.
If I put together a packet like "/test 12" nothing happens.

 

Repro: Install Max
Create a new patch that has one object "udpsend localhost 5050"
Create the following messages: 
  a) /test/test 12
  b) 12
  c) test
Modify the client test in the following ways
  1) Change the port to 5050 to match the udpsend from the Max object
  2) I commented out all of the code in the recieve message and just left a
      Console.Writeline("Received Message.");
      But, you don't get to this before the crash.

Here is the crash report:

—————————
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
—————————

 

 

    at OscMessage..ctor(IPEndPoint sourceEndPoint, String address, OscClient client) 

    at OscMessage..ctor(IPEndPoint sourceEndPoint, String address) 

    at OscMessage.FromByteArray(IPEndPoint sourceEndPoint, Byte[] data, Int32& start) 

    at OscPacket.FromByteArray(IPEndPoint sourceEndPoint, Byte[] data, Int32& start, Int32 end) 

    at OscPacket.FromByteArray(IPEndPoint sourceEndPoint, Byte[] data) 

    at OscServer.DataReceived(IPEndPoint sourceEndPoint, Byte[] data) 

    at OscServer.mUdpServer_DataReceived(Object sender, UdpDataReceivedEventArgs e) 

    at UdpServer.OnDataReceived(UdpDataReceivedEventArgs e) 

    at UdpServer.EndReceive(IAsyncResult asyncResult) 

    at LazyAsyncResult.Complete(IntPtr userToken) 

    at ContextAwareResult.CompleteCallback(Object state) 

    at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 

    at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 

    at ContextAwareResult.Complete(IntPtr userToken) 

    at LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken) 

    at BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 

    at _IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 

—————————
Abort   Retry   Ignore  
—————————

 I suspect that the OSC message from Max may not be formed correctly.
What is not clear to me is if this is a Max issue, the library, the way I created the message or a combo of all the options.

Any help would be greatly appreciated.

Thanks

11:32 am
December 13, 2010


Paul

Admin

posts 49

Hi Brett,

I'm unfamiliar with Cycling74 and Max, but I have a suspicion of what the problem is from what you've written. You mention that you're sending a packet via Max's udpsend. Looking at some reference material on udpsend at http://www.cycling74.com/docs/…..psend.html it's unclear if all messages are transmitted using Open Sound Control. There's some notion of a "FullMessage" that transmits the message via OSC, which seems to imply that non-FullMessage messages aren't OSC.

A simple way to determine exactly what data you're getting from Max, is to set a breakpoint within the OscMessage.FromByteArray() method within the Bespoke OSC Library source code. If you're unfamiliar with how to do this, just shout and I'll attempt to help. You're looking for the specific array of bytes that you're receiving from Max, and this will definitely tell you whether or not the message is properly formatted.

If you find the byte array, but have difficulty deciphering it, just post it to this thread and I'll have a look.

Paul

2:33 pm
December 13, 2010


Brett

Guest

Hi Brett,
I'm unfamiliar with Cycling74 and Max, but I have a suspicion of what the problem is from what you've written. You mention that you're sending a packet via Max's udpsend. Looking at some reference material on udpsend at http://www.cycling74.com/docs/…..d.html it's unclear if all messages are transmitted using Open Sound Control. There's some notion of a "FullMessage" that transmits the message via OSC, which seems to imply that non-FullMessage messages aren't OSC.
A simple way to determine exactly what data you're getting from Max, is to set a breakpoint within the OscMessage.FromByteArray() method within the Bespoke OSC Library source code. If you're unfamiliar with how to do this, just shout and I'll attempt to help. You're looking for the specific array of bytes that you're receiving from Max, and this will definitely tell you whether or not the message is properly formatted.
If you find the byte array, but have difficulty deciphering it, just post it to this thread and I'll have a look.
Paul

10:53 am
December 14, 2010


Paul

Admin

posts 49

Brett,

Did you intend to post another message? Your most recent forum post is just a reprint of my previous message. I'm replying so that you get an email of a response to the thread.

Paul

10:43 am
February 15, 2011


NebucadNessar

Netherlands

Member

posts 3

Hi Paul,

 

First of all great library you made, I am using it for a while already!

I do have some concerns relating to OSC address formatting.

Situation:

I am using the UDP server transport for listening to OSC messages.

The port I use is 10000 and it seems that this port is used by script kiddies alike to scan the internet and send garbage to that (udp) port. As a result this crashes the OSC udp server.

I am a C# beginner (and dutch) so forgive me if the following sentence is wrongly stated but in my own words I would describe the cause as following:

Cause of server crashing:

As soon as you send a non proper formatted OSC messages to the OSC UDP Client listener, the function routine: "ValueFromByteArray" in the OscPacket class wil give a system.IndexOutofRangeException because of the 'for itteration' not doing any boundschecking on the data[index] array.

Replay:

You can replay this problem using the tool: "netcat.exe" and send udp data to your server. For example:

"nc 192.168.1.10 10000 -u -vv" After this you can send ASCII chars to the udp port after after hitting <enter>

 

Question:

I solved some parts of the code by doing boundschecking on the "data" array by implementing:

if ((data.GetUpperBound(0) <=1) &&  (start <= data.GetUpperBound(0))

I would like to know if this is the way to go or is there a better way ?

 

 

Thanks,

 

Marcel.

 

 

 

 

 

 

 

 

No Tags

About the Bespoke Software forum



No Comment

Comments are closed.