예제 #1
0
 /// <summary>
 /// Immediately aborts the connection and releases all resources.
 /// </summary>
 public void Abort()
 {
     try { this.Socket.Close(); }
     catch { }
     this.Session.isValid = false;
     this.Socket          = null;
     this.Session         = null;
     this.dataBuffer      = null;
     this.Request         = null;
     this.Response        = null;
     this.reactorHandler  = null;
 }
예제 #2
0
        /// <summary>
        /// Checks if this IP address is banned, if so, the ban is processed, otherwise, the default reactors will be registered and handshake with client is performed..
        /// </summary>
        public void Initialize()
        {
            this.dataBuffer     = new byte[1024]; // Max 1024 characters per packet
            this.reactorHandler = new reactorHandler(this.Session);
            this.reactorHandler.Register(new securityReactor());
            this.reactorHandler.Register(new globalReactor());

            this.Socket.BeginReceive(this.dataBuffer, 0, this.dataBuffer.Length, SocketFlags.None, new AsyncCallback(this.dataArrival), null);

            this.Response.Initialize(0); // "@@" (handshake)
            this.sendMessage(Response);

            // Quick ping
            this.Response.Initialize(50); // "@r"
            this.sendMessage(Response);
        }
예제 #3
0
 /// <summary>
 /// Immediately aborts the connection and releases all resources.
 /// </summary>
 public void Abort()
 {
     try { this.Socket.Close(); }
     catch { }
     this.Session.isValid = false;
     this.Socket = null;
     this.Session = null;
     this.dataBuffer = null;
     this.Request = null;
     this.Response = null;
     this.reactorHandler = null;
 }
예제 #4
0
        /// <summary>
        /// Checks if this IP address is banned, if so, the ban is processed, otherwise, the default reactors will be registered and handshake with client is performed..
        /// </summary>
        public void Initialize()
        {
            this.dataBuffer = new byte[1024]; // Max 1024 characters per packet
            this.reactorHandler = new reactorHandler(this.Session);
            this.reactorHandler.Register(new securityReactor());
            this.reactorHandler.Register(new globalReactor());

            this.Socket.BeginReceive(this.dataBuffer, 0, this.dataBuffer.Length, SocketFlags.None, new AsyncCallback(this.dataArrival), null);

            this.Response.Initialize(0); // "@@" (handshake)
            this.sendMessage(Response);

            // Quick ping
            this.Response.Initialize(50); // "@r"
            this.sendMessage(Response);
        }