Exemple #1
0
 internal static void OnDiscoveryRequest(IPEndPoint remoteendpoint, NetPacketReader reader, UnconnectedMessageType messagetype)
 {
     if (messagetype == UnconnectedMessageType.Broadcast && reader.TryGetString(out string application) && application == Application.productName && Singleton.ProcessDiscoveryRequest(remoteendpoint, LiteNetLib4MirrorUtils.FromBase64(reader.GetString()), out string response))
     {
         LiteNetLib4MirrorCore.Host.SendUnconnectedMessage(LiteNetLib4MirrorUtils.ReusePutDiscovery(DataWriter, response, ref _lastDiscoveryMessage), remoteendpoint);
     }
     reader.Recycle();
 }
        public static void SendDiscoveryRequest(string text)
        {
            if (LiteNetLib4MirrorCore.State == LiteNetLib4MirrorCore.States.Discovery)
            {
                LiteNetLib4MirrorUtils.ReusePutDiscovery(DataWriter, text, ref _lastDiscoveryMessage);

                foreach (ushort port in Singleton.ports)
                {
                    LiteNetLib4MirrorCore.Host.SendBroadcast(DataWriter, port);
                }
            }
        }
Exemple #3
0
        public static void SendDiscoveryRequest(string text)
        {
            if (LiteNetLib4MirrorCore.State == LiteNetLib4MirrorCore.States.Discovery)
            {
                LiteNetLib4MirrorUtils.ReusePutDiscovery(DataWriter, text, ref _lastDiscoveryMessage);

                LiteNetLib4MirrorCore.Host.SendBroadcast(DataWriter, Singleton.port);

                if (Singleton.port > 2365)
                {
                    Singleton.port = 2345;
                }
                else
                {
                    Singleton.port++;
                }
            }
        }