예제 #1
0
    bool StartupPeer()
    {
        m_cRnPeer = new RakNet.RakPeer();
        m_usPort  = (ushort)UnityEngine.Random.Range(10000, 30000);


        RakNet.SocketDescriptor tSocketDesc    = new RakNet.SocketDescriptor((ushort)m_usPort, "");
        RakNet.StartupResult    eStartupResult = m_cRnPeer.Startup(1, tSocketDesc, 1);
        bool bPeerStarted = false;


        if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
        {
            Logger.WriteError("Raknet peer failed to start. ErrorCode({0}) Port({1})", eStartupResult, m_usPort);
        }
        else
        {
            bPeerStarted = true;
            m_cRnPeer.SetOccasionalPing(true);

            Logger.Write("Raknet peer started. Port({0})", m_usPort);
        }


        return(bPeerStarted);
    }
예제 #2
0
    bool StartupPeer(uint _uiNumSlots)
    {
        //m_cRnPeer = RakNet.RakPeerInterface.GetInstance();
        m_cRnPeer = new RakNet.RakPeer();


        RakNet.SocketDescriptor tSocketDesc    = new RakNet.SocketDescriptor((ushort)m_usPort, "");
        RakNet.StartupResult    eStartupResult = m_cRnPeer.Startup(_uiNumSlots, tSocketDesc, 1);
        bool bPeerStarted = false;


        if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
        {
            Logger.WriteError("Raknet peer failed to start. ErrorCode({0})", eStartupResult);
        }
        else
        {
            m_cRnPeer.SetMaximumIncomingConnections((ushort)_uiNumSlots);
            m_cRnPeer.SetOccasionalPing(true);
            SendCounter  = 0;
            bPeerStarted = true;


            Logger.Write("Server started with port ({0}) NumSlots({1})", m_usPort, _uiNumSlots);
        }

        return(bPeerStarted);
    }
예제 #3
0
    // private:


    void StartupPeer()
    {
        m_cRnPeer = new RakNet.RakPeer();
        m_usPort  = (ushort)UnityEngine.Random.Range(10000, 30000);


        RakNet.SocketDescriptor tSocketDesc    = new RakNet.SocketDescriptor((ushort)m_usPort, "");
        RakNet.StartupResult    eStartupResult = m_cRnPeer.Startup(1, tSocketDesc, 1);


        if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
        {
            Logger.WriteError("Master server peer failed to start. ErrorCode({0}) Port({1})", eStartupResult, m_usPort);
        }
    }
예제 #4
0
    bool StartupPeer()
    {
        m_cRnPeer = new RakNet.RakPeer();
        m_usPort = (ushort)UnityEngine.Random.Range(10000, 30000);


        RakNet.SocketDescriptor tSocketDesc = new RakNet.SocketDescriptor((ushort)m_usPort, "");
        RakNet.StartupResult eStartupResult = m_cRnPeer.Startup(1, tSocketDesc, 1);
        bool bPeerStarted = false;


        if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
        {
            Logger.WriteError("Raknet peer failed to start. ErrorCode({0}) Port({1})", eStartupResult, m_usPort);
        }
        else
        {
            bPeerStarted = true;
			m_cRnPeer.SetOccasionalPing(true);

            Logger.Write("Raknet peer started. Port({0})", m_usPort);
        }


        return (bPeerStarted);
    }
예제 #5
0
    // private:


	void StartupPeer()
	{
		m_cRnPeer = new RakNet.RakPeer();
		m_usPort = (ushort)UnityEngine.Random.Range(10000, 30000);


		RakNet.SocketDescriptor tSocketDesc = new RakNet.SocketDescriptor((ushort)m_usPort, "");
		RakNet.StartupResult eStartupResult = m_cRnPeer.Startup(1, tSocketDesc, 1);


		if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
		{
			Logger.WriteError("Master server peer failed to start. ErrorCode({0}) Port({1})", eStartupResult, m_usPort);
		}
	}
예제 #6
0
    bool StartupPeer(uint _uiNumSlots)
    {
        //m_cRnPeer = RakNet.RakPeerInterface.GetInstance();
        m_cRnPeer = new RakNet.RakPeer();


        RakNet.SocketDescriptor tSocketDesc = new RakNet.SocketDescriptor((ushort)m_usPort, "");
        RakNet.StartupResult eStartupResult = m_cRnPeer.Startup(_uiNumSlots, tSocketDesc, 1);
        bool bPeerStarted = false;


        if (eStartupResult != RakNet.StartupResult.RAKNET_STARTED)
        {
            Logger.WriteError("Raknet peer failed to start. ErrorCode({0})", eStartupResult);
        }
        else
        {
            m_cRnPeer.SetMaximumIncomingConnections((ushort)_uiNumSlots);
			m_cRnPeer.SetOccasionalPing(true);
			SendCounter = 0;
            bPeerStarted = true;


            Logger.Write("Server started with port ({0}) NumSlots({1})", m_usPort, _uiNumSlots);
        }

        return (bPeerStarted);
    }