need an approch for my problem definition. Please kindly take sometime to read the problem

simultenios calls , csharp , windows service , ip cameras , comsole application India
  • 7 years ago

    Hello ,

    I need an approach for my new assignment.Thought a lot but could'nt find an approach so posting it in this site hoping that someone might have come accross this situation and can suggest me something :-)

    I have a console application that downloads images from IP cameras (say cctv cameras in shoping Malls) as per the time specified in Database. I am using windows service with a timer for initial POC. I will try to explain the scenario for which I am not finding an approach:

    Say I have four cemaras 1. Camera1 2. Camera2 3. Camera3 4. Camera4

    Now as per the database records, I have to capture the image at exactly 7 AM in the morning for all the cameras. Now my windows service can have one call at a time. If I loop through and call the request for camera1 first then I will get the 7 AM picture frame(image) for camera1. But till the request comes for camera4 the time will be different and I will not be able to capture image for camera4 at 7 Am, may be I will get the image of 7.05 AM.

    I cannot create 4 windows service as how many cameras will be there is decided by the records in the database which I have to read dynamically, So there may be more then 4 cameras or even less then 4.

    So my question is how can I have a 4 or even more calls simalteniously and get the picture frame of the specified time ?? There may be 100 cameras as well :-(

    Hope I am able to explain the situation. Please let me know if you have come accross this kind of problem and have some idea about the solution.

    Thanks & Regards, Suraj

  • 7 years ago

    Make the asynchronous calls ->

    If you have to execute a method asynchronously Create a delegate with the same method as method you want to call. Suppose you have a method which accepts a string and returns void then declare a delegate. private delegate void LaunchDelegate(string batch); LaunchDelegate launch = new LaunchDelegate();

    Call del.BeginInvoke(parameters, new AsyncCallBack()); You can change these parameter inside loop.

    Make sure that you dont set waitForExit to true, so as soon you call this method it will call the method and returns back and you can proceed further with all the cameras.

    Create a call back method like this: void PAWConfigDBProcessComplete(IAsyncResult itfAR) { // You can use this state for any processing (string)itfAR.AsyncState;

        }
    

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne