UDP control of a joint using Java script

I am trying to write a Java Script that can receive UDP packets from MATLAB/ any other program, and use them to control a character.

Can any one give me a simple Java Script where a ball/any object in Unity is controlled by received UDP packets?, So I can learn from example, how to open a UDP connection, setup the communication and control position/rotation of ball/any object.

Many thanks for the help.

You can read this post. http://forum.unity3d.com/threads/16882-MIDI-or-OSC-for-Unity-Indie-users/page2?highlight=midi You do it for kinect I`m very interested in it.