Ejemplo n.º 1
0
        private void clientComm()
        {
            while (Thread.CurrentThread.IsAlive)
            {
                try
                {
                    KClientPaquet cp = new KClientPaquet(client.GetStream());
                    string s = cp.getQuery();
                    System.Console.WriteLine("Query : " + s);

                    KQuery q = new KQuery(cp.getQuery(),client.GetStream());
                    byte code = q.process();
                    KServerPaquet sp = new KServerMessagePaquet(code, q.action.rData);
                    sp.send(client.GetStream());
                }
                catch (KActionException e)
                {
                    Console.WriteLine(e.exceptionNumber);
                    KServerPaquet sp = new KServerMessagePaquet(222, "SMURK");
                    sp.send(client.GetStream());
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("Error : " + Thread.CurrentThread.Name + " : " + e.Message);
                    break;
                }

            }

            closeClient();
        }
Ejemplo n.º 2
0
        private void clientComm()
        {
            while (Thread.CurrentThread.IsAlive)
            {
                try
                {
                    KClientPaquet cp = new KClientPaquet(client.GetStream());
                    string        s  = cp.getQuery();
                    System.Console.WriteLine("Query : " + s);


                    KQuery        q    = new KQuery(cp.getQuery(), client.GetStream());
                    byte          code = q.process();
                    KServerPaquet sp   = new KServerMessagePaquet(code, q.action.rData);
                    sp.send(client.GetStream());
                }
                catch (KActionException e)
                {
                    Console.WriteLine(e.exceptionNumber);
                    KServerPaquet sp = new KServerMessagePaquet(222, "SMURK");
                    sp.send(client.GetStream());
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("Error : " + Thread.CurrentThread.Name + " : " + e.Message);
                    break;
                }
            }

            closeClient();
        }