예제 #1
0
    public ISession CreateSession()
    {
        ++session_id;
        SSClientSession session = new SSClientSession();

        session.SetSessID(session_id);
        session.SetCoder(coder);
        session.SetHandler(handler);
        session.SetSessionFactory(this);
        Log.InfoAf("[SSClientSessionMgr] CreateSession={0}", session.GetSessID());
        return(session);
    }
예제 #2
0
    public UInt64 Connect(string _host, UInt32 _port, ISSClientSessionHandler _handler, ICoder _coder)
    {
        _handler.Init();

        SSClientSession session = (SSClientSession)CreateSession();

        session.SetHandler(_handler);
        session.SetCoder(_coder);
        session.SetConnectType();

        ConnectCache cache = new ConnectCache(session.GetSessID(), _host, _port, Util.GetMillSecond() + mgr_beat_heart_max_time);

        connect_cache_dict[session.GetSessID()] = cache;
        Log.InfoAf("[SSClientSessionMgr] ConnectCache Add SessionID={0},Host={1} Port={2}", session.GetSessID(), _host, _port);

        Net.Instance.Connect(_host, _port, session);
        return(session.GetSessID());
    }