void InitSocket() { socket = UDP.Create(bufferSize, bufferSize); UDP.SetDontFragment(socket); UDP.SetNonBlocking(socket); needsDisposing = true; }
// Use this for initialization public void setup() { //udp = this.gameObject.GetComponent<UDP>(); if (udp == null) { udp = this.gameObject.AddComponent <UDP>(); } if (!udp.IsOpen()) { udp.Setup(); udp.SetupSender(ip, sendPort); udp.Create(); } }
public void setup() { udp = this.gameObject.GetComponent <UDP>(); if (udp == null) { udp = this.gameObject.AddComponent <UDP>(); } if (!udp.IsOpen()) { udp.Setup(); udp.SetupReceiver(receivePort); //udp.SetReceiveDataHandler(OnReceiveData); //udp.SetReceivePacketHandler(OnReceivePacket); udp.SetReceiveDataQueueHandler(OnReceiveDataQueue); udp.Create(); } }
// Use this for initialization void Start() { udp.Setup("127.0.0.1", 11999, 11999); udp.SetReceivePacketHandler(OnReceivePacket); udp.Create(); }