金铉Unity插件库 Unity版本2018.4.32f 目前包含本地化存储功能(根据类名存储读写),TCP客户端监听类型功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
845 B

using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
public class UDPPrinter : MonoBehaviour
{
private UDPUtility udpUtil;
// Start is called before the first frame update
void Start()
{
udpUtil = new UDPUtility("192.168.1.41", 20000);
udpUtil.sendData("hello everyone!");
}
// Update is called once per frame
void Update()
{
if (udpUtil != null && !"".Equals(udpUtil.getReceivedValue()))
{
Debug.Log(udpUtil.receivedData.Value);
}
}
private void OnDestroy()
{
if (udpUtil.reciveT != null && udpUtil.reciveT.ThreadState == ThreadState.Running)
{
udpUtil.reciveT.Abort();
}
}
}