Beispiel #1
0
        internal SendMessageTask(NTcpListener listenser)
        {
            _Listener        = listenser;
            _TotalQueueCount = 0;
            Event            = new AutoResetEvent(false);

            _Thread = new ProcessorThread(ThreadProc);

            _Thread.IsBackground = true;
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (System.IO.File.Exists("channel.txt"))
            {
                System.IO.File.Delete("channel.txt");
            }

            _Thread = new Thread(Statistic);
            _Thread.IsBackground = true;

            listener = new NTCPMSG.Server.NTcpListener(new IPEndPoint(IPAddress.Any, 2500));
            listener.DataReceived       += new EventHandler <ReceiveEventArgs>(ReceiveEventHandler);
            listener.ErrorReceived      += new EventHandler <ErrorEventArgs>(ErrorEventHandler);
            listener.RemoteDisconnected += new EventHandler <DisconnectEventArgs>(DisconnectEventHandler);
            _Thread.Start();

            listener.Listen();

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Beispiel #3
0
        internal SCB(Server.NTcpListener listener, Socket workSocket)
        {
            _Listener = listener;

            lock (_SCBID_LOCK)
            {
                Id = _SCB_ID++;
            }

            this._CurState   = State.Sync0;
            this.WorkSocket  = workSocket;
            _MSGHead[0]      = 0xA5;
            _MSGHead[1]      = 0xA5;
            RemoteIPEndPoint = (IPEndPoint)workSocket.RemoteEndPoint;
            //AddTCB(this);

            _MStream = new System.IO.MemoryStream(MStreamCapacity);

            WorkSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None,
                                    new AsyncCallback(Async_Receive), WorkSocket);
        }