Beispiel #1
0
        public bool Listen(int serverListenPort, HostTopology topology)
        {
            m_HostTopology = topology;
            Initialize();
            m_ListenPort = serverListenPort;

            if (m_UseWebSockets)
            {
                m_ServerHostId = m_UseRelay ? RelayTransport.AddWebsocketHost(m_HostTopology, serverListenPort, true) : NetworkTransport.AddWebsocketHost(m_HostTopology, serverListenPort);
            }
            else
            {
                m_ServerHostId = m_UseRelay ? RelayTransport.AddWebsocketHost(m_HostTopology, serverListenPort, true) : NetworkTransport.AddHost(m_HostTopology, serverListenPort);
            }

            if (m_ServerHostId == -1)
            {
                return(false);
            }

            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkServerSimple listen " + m_ListenPort);
            }
            return(true);
        }
Beispiel #2
0
        public bool Listen(string ipAddress, int serverListenPort)
        {
            Initialize();
            m_ListenPort = serverListenPort;

            if (m_UseWebSockets)
            {
                m_ServerHostId = m_UseRelay ? RelayTransport.AddWebsocketHost(m_HostTopology, serverListenPort, ipAddress, true, RelayTransport.RelayAddress, RelayTransport.RelayPort) : NetworkTransport.AddWebsocketHost(m_HostTopology, serverListenPort, ipAddress);
            }
            else
            {
                m_ServerHostId = m_UseRelay ? RelayTransport.AddHost(m_HostTopology, serverListenPort, ipAddress, true, RelayTransport.RelayAddress, RelayTransport.RelayPort) : NetworkTransport.AddHost(m_HostTopology, serverListenPort, ipAddress);
            }

            if (m_ServerHostId == -1)
            {
                return(false);
            }

            if (LogFilter.logDebug)
            {
                Debug.Log("NetworkServerSimple listen: " + ipAddress + ":" + m_ListenPort);
            }
            return(true);
        }