From 1e46148e5669c166343630678afd2b8547499582 Mon Sep 17 00:00:00 2001 From: "DESKTOP-B25GA9E\\W35" <1733709035@qq.com> Date: Tue, 13 Dec 2022 10:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86udp=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UDPClient/UDPPrinter.cs | 5 +---- Assets/UDPClient/UDPUtility.cs | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Assets/UDPClient/UDPPrinter.cs b/Assets/UDPClient/UDPPrinter.cs index 29242be..f7daece 100644 --- a/Assets/UDPClient/UDPPrinter.cs +++ b/Assets/UDPClient/UDPPrinter.cs @@ -13,7 +13,7 @@ public class UDPPrinter : MonoBehaviour // Start is called before the first frame update void Start() { - udpUtil = new UDPUtility("127.0.0.1", 20000); + udpUtil = new UDPUtility("192.168.1.41", 20000); udpUtil.sendData("hello everyone!"); } @@ -22,9 +22,6 @@ public class UDPPrinter : MonoBehaviour { if (udpUtil != null && !"".Equals(udpUtil.getReceivedValue())) { - /*GameObject item = Instantiate(tcpMsgItem, tcpMsgContent); - item.GetComponentInChildren().text = tcpUtil.receivedData.Value; - this.GetModel().onDataRecived.Invoke(tcpUtil.receivedData.Value);*/ Debug.Log(udpUtil.receivedData.Value); } } diff --git a/Assets/UDPClient/UDPUtility.cs b/Assets/UDPClient/UDPUtility.cs index 3e37962..8188bf5 100644 --- a/Assets/UDPClient/UDPUtility.cs +++ b/Assets/UDPClient/UDPUtility.cs @@ -78,7 +78,7 @@ public class UDPUtility : IUtility public void RecciveMsg() { string msg = ""; - Debug.Log("StartReceiving!"); + //Debug.Log("StartReceiving!"); while (isOpenUDP.Value) { try @@ -98,7 +98,7 @@ public class UDPUtility : IUtility //断线发送异常 isTimeOut.Value = true; exceptionData.Value = e.ToString(); - break; + //break; } } Debug.Log("------------end While-------------");