Esempio n. 1
0
        public TcpPushClient(int receiveBufferSize)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {
                tcpClients            = new TcpClients(receiveBufferSize);
                tcpClients.OnConnect += TcpServer_eventactionConnect;
                tcpClients.OnReceive += TcpServer_eventactionReceive;
                tcpClients.OnSend    += TcpClients_OnSend;
                tcpClients.OnClose   += TcpServer_eventClose;
            }));

            thread.IsBackground = true;
            thread.Start();
        }
Esempio n. 2
0
        public TcpPackClient(int receiveBufferSize, uint headerFlag)
        {
            //headerflag from 0-1023, when flag set to 0, don't check header
            if (headerFlag < 0 || headerFlag > 1023)
            {
                headerFlag = 0;
            }
            this.headerFlag = headerFlag;
            Thread thread = new Thread(new ThreadStart(() =>
            {
                queue                 = new List <byte>();
                tcpClients            = new TcpClients(receiveBufferSize);
                tcpClients.OnConnect += TcpClients_OnConnect;
                tcpClients.OnReceive += TcpClients_OnReceive;
                tcpClients.OnClose   += TcpClients_OnClose;
                tcpClients.OnSend    += TcpClients_OnSend;
                tcpClients.OnError   += TcpClients_OnError;
            }));

            thread.IsBackground = true;
            thread.Start();
        }