123456789101112131415161718192021222324252627282930 |
- using System;
- using UnityEngine;
- public class PolarListener : MonoBehaviour
- {
- private UdpConnection connection;
- private void Start()
- {
- string sendIp = "127.0.0.1";
- int sendPort = 8881;
- int receivePort = 6789;
-
- connection = new UdpConnection();
- connection.StartConnection(sendIp, sendPort, receivePort);
- }
- private void Update()
- {
-
- foreach (var message in connection.getMessages()) Debug.Log(message);
-
- connection.Send("Hi!");
- }
- private void OnDestroy()
- {
- connection.Stop();
- }
- }
|