예제 #1
0
    public bool StartServer(int port, int connectionMax, ConnectionType type)
    {
        Debug.Log("Start server called.!");

        // 리스닝 소켓 생성.
        try {
            if (type == ConnectionType.Reliable)
            {
                // 도달 보장을 위한 TCP 통신 시작.
                m_sessionTcp.StartServer(port, connectionMax);
            }
            else
            {
                // 도달 보장이 필요치 않는 UDP 통신은 언제든지 받을 수 있게 리스닝 시작.
                m_sessionUdp.StartServer(port, connectionMax);
            }
        }
        catch {
            Debug.Log("Server fail start.!");
            return(false);
        }

        Debug.Log("Server started.!");


        return(true);
    }
예제 #2
0
    /*
     * +-------------------------+
     * |         Server          |
     * +-------------------------+
     */

    public bool StartServer(int port, int connectionMax, ConnectionType type)
    {
        try {
            if (type == ConnectionType.TCP)
            {
                sessionTcp.StartServer(port, connectionMax);
            }

            if (type == ConnectionType.UDP)
            {
                sessionUdp.StartServer(port, connectionMax);
            }
        } catch (Exception e) {
            NetworkLogger.Log(e.ToString());
            return(false);
        }

        return(true);
    }