Esempio n. 1
0
        public void StartUp()
        {
            try
            {
                string uri     = ConfigurationManager.AppSettings["WcfAnnouncementConnectionUri"];
                int    timeout = int.Parse(ConfigurationManager.AppSettings["WcfAnnouncementFrequencyPeriodSec"]);
                bool   enable  = bool.Parse(ConfigurationManager.AppSettings["EnableWcfAnnouncement"]);

                m_NetworkHost.Open(uri, timeout, enable);
                m_CargoHostEndPoint.Open();
            }
            catch (Exception)
            {
            }

            if (!m_ClientConnThread.IsAlive)
            {
                m_ClientConnThread.Start();
            }

            if (!m_HostConnThread.IsAlive)
            {
                m_HostConnThread.Start();
            }
        }
Esempio n. 2
0
        public void StartUp()
        {
            if (CaseListUpdateEvent != null)
            {
                foreach (CaseListDataSet.CaseListTableRow row in base.caseList.List.CaseListTable.Rows)
                {
                    CaseListUpdateEvent(row.CaseId, string.Empty, true);
                }
            }

            if (!ClientConnThread.IsAlive)
            {
                ClientConnThread.Start();
            }

            try
            {
                string uri     = ConfigurationManager.AppSettings["WcfAnnouncementConnectionUri"];
                int    timeout = int.Parse(ConfigurationManager.AppSettings["WcfAnnouncementFrequencyPeriodSec"]);
                bool   enable  = bool.Parse(ConfigurationManager.AppSettings["EnableWcfAnnouncement"]);

                acsCommHost.Open(uri, timeout, enable);
            }
            catch (Exception)
            {
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Start up the network manager. This should be called by Lobby.cs
        /// when the server host IP has been discovered and is connectable.
        /// </summary>
        ///
        /// <param name="serverAddr">
        /// As server, local IP address to host on.
        /// As client, remote server IP address to connect to.
        /// </param>
        ///
        /// <param name="nwMode">
        /// Are you the server or client?
        /// </param>
        ///
        /// <param name="useDNS">
        /// If serverAddr is a local IP, convert it via DNS? Set to false if using wifi-direct IP address.
        /// </param>
        ///
        /// <returns>
        /// True if successful.
        /// If client, use this.NetworkHost.ConnectionCount == 1 afterwards to confirm connection to server.
        /// </returns>
        public bool Run(string serverAddr, NetworkMode nwMode, bool useDNS = true)
        {
            ServerAddress = serverAddr;
            Mode          = nwMode;

            // Construct serializer and packet queue
            Serializer  = new XMLPacketSerializer();
            PacketQueue = new PacketQueue(Serializer);

            // Create and configure host
            if (Mode == NetworkMode.Server)
            {
                // Convert any "local address" to the "dns local address"
                if (useDNS && NetworkHost.IsLocalAddress(ServerAddress))
                {
                    ServerAddress = NetworkHost.GetLocalAddress();
                }

                // Server, configures socket to be "known" at this address
                Debug.Log("NetworkManager: As a server, I am using server IP: " + ServerAddress);
                NetworkHost = new NetworkHost(ServerAddress, ServerPort, 4);
            }
            else
            {
                // Client, connect to server
                NetworkHost = new NetworkHost(4);
            }

            // Configure channels and open/allow connections.
            NetworkHost.ConfigureChannel("info", ChannelType.ReliableSequenced);
            NetworkHost.ConfigureChannel("state", ChannelType.UnreliableStateUpdate);
            NetworkHost.ConfigureChannel("input", ChannelType.ReliableStateUpdate);
            bool rv = NetworkHost.Open();

            if (!rv)
            {
                NetworkHost.Dispose();
                NetworkHost = null;
                return(false);
            }

            // Connect client to server
            if (Mode == NetworkMode.Client)
            {
                Debug.Log("NetworkManager: As a client, I am using server IP: " + ServerAddress);
                NetworkHost.Connect(ServerAddress, ServerPort);
            }

            // Allow FixedUpdate() to run.
            IsRunning = true;

            return(true);
        }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        KnownPeople = new HashSet <NetworkInfo>();
        Serializer  = new JSONPacketSerializer();

        //
        Network = new NetworkHost(9560, 1);
        Network.ConfigureChannel("broadcast", ChannelType.UnreliableUnordered);
        Network.Open();

        // Mark broadcast credentials
        Network.SetBroadcastCredentials(1234, 1);

        //
        NetworkHost.StartBroadcast(Network, Encoding.ASCII.GetBytes(NetworkHost.GetLocalAddress()));

        //
        var textUi = GetComponent <Text>();

        textUi.text = "";
    }
Esempio n. 5
0
 public void Start()
 {
     host.Open();
     m_FileSystemWatcher.EnableRaisingEvents = true;
 }
Esempio n. 6
0
 public void Open()
 {
     _networkHost.Open();
     //_udpClient.Connect(_remoteEp);
 }
Esempio n. 7
0
 public virtual void Start()
 {
     host.Open();
 }
Esempio n. 8
0
 public void Start()
 {
     _NetworkHost.Open();
     _FileSystemWatcher.EnableRaisingEvents = true;
 }