Esempio n. 1
0
 void streamReader(NetworkStream st, TcpClient cl, Connection.ClStreamObj myClStreamObj) {
     Console.WriteLine( "reader running" );
     while ( cl.Connected ) {
         if ( st.DataAvailable ) {
             Console.WriteLine( "revise data.." );
             new Thread( () => processBuffer( Connection.ReadStream( st, cl.Available ), cl.GetHashCode() ) ).Start();
             Connection.WriteStream( st, NetMessage.OK );
         }
     }
 }
Esempio n. 2
0
        private void ManageClient(TcpClient cl) {
            var str = cl.GetStream();
            var ob  = new Connection.ClStreamObj( str, cl );
            this._clStreams.Add( ob );
            var t = new Thread( () => streamReader( str, cl, ob ) );
            t.Start();
            t.Join();

            this._clStreams.Remove( ob );
            Console.WriteLine( "client dc..." );
            //new Thread( () => streamWriter( str,cl ) ).Start();
        }