Пример #1
0
    void Send(byte[] data, ProtoType msgType)
    {
        if (data == null)
        {
            Debug.LogError("发送数据错误");
            return;
        }
        switch (msgType)
        {
        case ProtoType.Importance:
            client.SendMsg(data);
            break;

        case ProtoType.Unimportance:
            if (differentUdpPort)
            {
                foreach (var ip in broadCastList)
                {
                    multidataConnection.SendTo(data, ip.Value);
                }
            }
            else
            {
                multidataConnection.BroadCast(data);
            }
            break;
        }
    }
Пример #2
0
 /// <summary>
 /// XYZ一起发送
 /// </summary>
 public void SetAttitude(float x, float y, float z)
 {
     sendString.Remove(0, sendString.Length);
     sendString.Append(CMD_SETATTITUTDE);
     sendString.Append(x);
     sendString.Append(CMD_SPLIT);
     sendString.Append(y);
     sendString.Append(CMD_SPLIT);
     sendString.Append(z);
     sendUdp.SendTo(ASCIIEncoding.ASCII.GetBytes(sendString.ToString()), recverID);
 }