19 lines
510 B
C#
19 lines
510 B
C#
|
using Network;
|
||
|
using System.Text;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Test
|
||
|
{
|
||
|
public class UdpClientTest : MonoBehaviour
|
||
|
{
|
||
|
private async void Start()
|
||
|
{
|
||
|
var sendBytes = Encoding.UTF8.GetBytes("Test 汉语 and English simultaneously!");
|
||
|
|
||
|
var receivedBytes = await UnityUdpClient.Instance.SendAndReceiveData(sendBytes);
|
||
|
var receivedString = Encoding.UTF8.GetString(receivedBytes);
|
||
|
|
||
|
Debug.Log($"Received string: {receivedString}");
|
||
|
}
|
||
|
}
|
||
|
}
|