Пример #1
0
        /// <summary>
        /// Begins broadcasting the given message on the local subnet using the given host.
        /// </summary>
        public static void StartBroadcast(NetworkHost host, byte[] message)
        {
            if (!host.IsOpen)
            {
                throw new InvalidOperationException("Unable to start broadcast, local host not open.");
            }
            if (host._BroadcastKey == -1)
            {
                throw new InvalidOperationException("Unable to start broadcast, host credentials not set");
            }

            //
            byte error;

            NetworkTransport.StartBroadcastDiscovery(host.Id, host.NetworkInfo.Port, host._BroadcastKey, host._BroadcastVersion, 0, message, message.Length, 500, out error);
            if (error > 0)
            {
                throw new NetworkException("Error setting broadcast credentials", error);
            }
        }
 internal NetworkConnection(NetworkHost host, int id)
 {
     Id   = id;
     Host = host;
 }