Esempio n. 1
0
        /***
         * Connect
         */
        public void OnConnect(IAsyncResult AsyncResult)         //worker thread for receiving and processing packets
        {
            try
            {
                if (socket != null)
                {
                    socket.EndConnect(AsyncResult);
                    isConnected = true;
                    Console.WriteLine("Client connected...");
                    this.StatusType = Status.kConnected;
                    Thread.Sleep(2000);
                    SendPacket.sendReady();

                    //socket.BeginReceive(recvBuffer, 0, recvBuffer.Length, 0, new AsyncCallback(SocketEventCallback.ReceiveCallback), this);
                }
            }
            catch (SocketException e)
            {
                if (e.SocketErrorCode == SocketError.ConnectionReset || e.SocketErrorCode == SocketError.ConnectionAborted)
                {
                    Disconnect();
                }
            }
        }
Esempio n. 2
0
 private static void drawDesktop()
 {
     try
     {
         /*
          * if(Frame.FrameReady)
          * {
          *      if(texture1.Width != Frame.Width || texture1.Height != Frame.Height)
          *      {
          *              texture1 = new Texture2D(Frame.Width ,Frame.Height,false,PixelFormat.Rgba);
          *              texture2 = new Texture2D(Frame.Width ,Frame.Height,false,PixelFormat.Rgba);
          *      }
          *
          *      texture1.SetPixels(0,Frame.FrameBuffer1);
          *      texture2.SetPixels(0,Frame.FrameBuffer2);
          *
          *      sceneMain.updateImage(texture1,texture2);
          *
          *      //SendPacket.sendReady();
          *      //GC.Collect();
          *
          * }
          * Draw.render(texture1, texture2);
          */
         Draw.render(Frame.ScreenTexture);
         if (Frame.FrameReady == true)
         {
             SendPacket.sendReady();
             Frame.FrameReady = false;
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }