Example #1
0
        public Webcam(TcpClient client, string basePath)
        {
            tcpClient = client;
            networkStream = tcpClient.GetStream();
            name = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address.ToString();
            folderPath = basePath;
            RecordVideo = false;
            MotionDetected = false;

            ThreadStart listener = new ThreadStart(OnTcpReceived);
            Thread thread = new Thread(listener);
            thread.Start();

            imageReceiver = new ImageReceiver();
            imageReceiver.FrameReceived += new FrameHandler(imageReceiver_FrameReceived);
            SendMessage("hello " + imageReceiver.ListenPort);
        }
Example #2
0
        public void Dispose()
        {
            if (imageReceiver != null)
                imageReceiver.Dispose();
            if (networkStream != null)
                networkStream.Close();
            if (tcpClient != null)
                tcpClient.Close();

            imageReceiver = null;
            networkStream = null;
            tcpClient = null;
        }