How to receive streaming data over a UDP connection?

First of all, I wonder how do we define that our connection is a UDP and not TCP? Second, In unity3d, i want to receive a string data being streamed over a local connection sent by another software (it's not a unity app)

I tried the OnSerializeNetworkView function, but it doesn't work, cause simply BitStream does not support string values.

here is the code:

var listenPort = 25000;
var newMsg:char;

function Start(){
 StartServer();
}

function StartServer () {
    Network.InitializeServer(1, listenPort);
}

function OnServerInitialized() {
    Debug.Log("Server is running");
}

function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) {
    var newData: char;
    stream.Serialize(newData);
    newMsg = newData;
    print(newMsg.ToString());
}

could someone turn the lights on :)

lot of thanks,

You need to write a dll that contains the Javascript code necessary for defining your connections. You will then need to extend that code in your Unity Script so that you can access the class or however you choose to do it. A simple google search should find you an example of a Javascript UDP client and server application. Then you simply modify it for use in your game. UDP Client – Coding Friends This has the Javascript code for connecting through a UDP Socket. I realize this thread is very old but I saw the large number of views and no replies. It was similar enough to my question that I felt like answering it. Hope this is of any use to someone.