Esempio n. 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            screenCapture.Area = 2;
            server             = new TCPConnection();



            server.localPort = 8080;
            server.listen();

            screenCapture.init();

            //jonathan get ip direction
            string      sHostName = Dns.GetHostName();
            IPHostEntry ipEntry   = Dns.GetHostEntry(sHostName);

            IPAddress[] IpAddr = ipEntry.AddressList;

            int smallestIndex = 0;

            for (int ipIndex = 1; ipIndex < IpAddr.Length; ++ipIndex)
            {
                if (IpAddr[smallestIndex].ToString().Length > IpAddr[ipIndex].ToString().Length)
                {
                    smallestIndex = ipIndex;
                }
            }

            serverPort = IpAddr[smallestIndex] + ":" + server.localPort;
            //Console.WriteLine(serverPort);
            label4.Text = "IP Adress : " + IpAddr[smallestIndex] + "    Port: " + server.localPort;           //jonathan place for image quiality


            screenCapture.Resolution = 50; //jonathan posible place to change capturesize
            screenCapture.Quality    = 50; //original value 50
            screenCapture.Area       = 20;
            screenCapture.X          = 0;
            screenCapture.Y          = 0;
            stopWatch.Start();

            boundary = System.Text.ASCIIEncoding.ASCII.GetBytes("--boundary");
            //deskTopHwnd = screenCapture.GetDesktopWindow();
        }
Esempio n. 2
0
 public static void sendPing(TCPConnection socket)
 {
     byte[] ping = { 255, 0, 255, 0 };
     socket.send(ping);
 }
Esempio n. 3
0
        public static void ReceiveCallback(IAsyncResult ar)
        {
            TCPConnection TCPrcv = (TCPConnection)ar.AsyncState;

            TCPrcv.dataArrival(ar);
        }
Esempio n. 4
0
        public static void SendCallback(IAsyncResult ar)
        {
            TCPConnection TCPsnd = (TCPConnection)ar.AsyncState;

            TCPsnd.onSend(ar);
        }
Esempio n. 5
0
        public static void AcceptCallback(IAsyncResult ar)
        {
            TCPConnection Server = (TCPConnection)ar.AsyncState;

            Server.connectionRequest(ar);
        }