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); }
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); }
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); }
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); }