Ejemplo n.º 1
0
    /*
     * +-------------------------+
     * |       Connection        |
     * +-------------------------+
     */

    public int Connect(string address, int port, ConnectionType type)
    {
        int node = -1;

        if (type == ConnectionType.TCP)
        {
            node = sessionTcp?.Connect(address, port) ?? -1;
        }

        if (type == ConnectionType.UDP)
        {
            node = sessionUdp?.Connect(address, port) ?? -1;
        }

        return(node);
    }
Ejemplo n.º 2
0
    //
    public int Connect(string address, int port, ConnectionType type)
    {
        int node = -1;

        if (type == ConnectionType.Reliable && m_sessionTcp != null)
        {
            // 도달 보장을 위한 TCP 통신을 시작.
            node = m_sessionTcp.Connect(address, port);
        }

        if (type == ConnectionType.Unreliable && m_sessionUdp != null)
        {
            // 도달 보장을 하지 않는 UDP 통신을 시작.
            node = m_sessionUdp.Connect(address, port);
        }

        return(node);
    }