예제 #1
0
파일: GSHost.cs 프로젝트: lythm/orb3d
        public bool Open()
        {
            string listener_addr = ConfigurationSettings.AppSettings["listener_addr"];

            string listener_port = ConfigurationSettings.AppSettings["listener_port"];

            string session_count = ConfigurationSettings.AppSettings["session_count"];

            FSessionManager = new GSSessionManager(Convert.ToInt32(session_count), 1);

            FAcceptSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            IPAddress addr = IPAddress.Parse(listener_addr);

            IPEndPoint ep = new IPEndPoint(addr, Convert.ToInt32(listener_port));

            FAcceptSock.Bind(ep);

            FAcceptSock.Listen(1000);

            Accept();

            return true;
        }
예제 #2
0
파일: GSSession.cs 프로젝트: lythm/orb3d
        public GSSession(GSSessionManager manager)
        {
            FSessionManager = manager;

            FPacketHandler = new SessionPacketHandler(this);

            FPacketSpliter = new PacketSpliter();

            FPacketSpliter.OnPacket += FPacketHandler.OnPacket; ;

            FSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            FAcceptEventArg = new SocketAsyncEventArgs();

            FAcceptEventArg.AcceptSocket = FSock;

            FAcceptEventArg.Completed += OnCompleted;

            FAcceptEventArg.UserToken = this;

            FBufferManager = new SockBufferManager();

            FBufferManager.Initialize(10, 10);
        }