来源:http://forum.unity3d.com/threads/windows-udp-voice-recognition-server.172758/
// *********************************************************
// UDP SPEECH RECOGNITION
// *********************************************************
using UnityEngine;
using System.Collections;
using System;
using System.Net;
using System.Text;
using System.Net.Sockets;
using System.Threading;
public class UDP_RecoServer : MonoBehaviour
{
Thread receiveThread;
UdpClient client;
public int port = 6000; // DEFAULT UDP PORT !!!!! THE QUAKE ONE ;)
string strReceiveUDP = "";
string LocalIP = String.Empty;
string hostname;
public void Start()
{
Application.runInBackground = true;
init();
}
// init
private void init()
{
receiveThread = new Thread( new ThreadStart(ReceiveData));
receiveThread.IsBackground = true;
receiveThread.Start();
hostname = Dns.GetHostName();
IPAddress[]