public void SendData(byte[] buffer, int size)
 {
     udpClient.sendBufferSize = size;
     for (int i = 0; i < size; i++)
     {
         udpClient.sendBuffer[i] = buffer[i];
     }
     int sent = udpClient.SendTo(target);
 }
示例#2
0
        private void NetworkLoop()
        {
            while (status == NetworkStatus.Active)
            {
                //Debug.Log(status);
                udpClient.Receive();

                SendSocketData();
                int sent = udpClient.SendTo(multicastEndPoint);
                //Debug.Log(sent + " bytes sent");
                Thread.Sleep(NETWORK_SLEEP);
            }

            udpClient.Close();
        }