How work and be able to run a function in real time?

TrucBidule

New member
Joined
Jul 19, 2022
Messages
2
Programming Experience
1-3
(I USE .NET 5.0)
So, i created a post on StackOverFlow but they closed my question due to not have enough braincells.

You can see the comment you can have a question already awnsered here: How work and be able to run a function in real time?

So i start project that's need real time "update" like i have my console project, i create function to execute in real time (example below) and i want like (
C#:
if(toExec()) => execute toClose()
).

C#:
        string theApp = "cmd.exe";
        Boolean toExec()
        {
            if (app.isOpen(theApp))
            {
                return true;
            }
            else
                return false;
        }

        void toClose()
        {
            if (theApp != null)
                app.Close(theApp);
        }

If you are questionning about what mean "real time", imagine Windows Defender detect something on your pc, you don't need to launch Defender and select the program to analysis it's automatic, it's the same concept except that but instead i need to detect something CPU friendly when it open like when cmd.exe open i want it close. (
C#:
i don't want to create do{ if(toExec()) => execute toClose() }while(true)

For all another question check my old question comment or post a comment here
 
Last edited by a moderator:
I recommend stepping back, and re-posting your question here with all the details that was asked of you on StackOverflow. It just smacks of laziness if you are telling us to go read the comments in SO regarding the question you are posting here. I get it sometimes, there is just something bubbling inside of us that we want to ask. Been there, too. Unfortunately, other people can't read our mind and if just blurt out the question, it comes across as jibberish.

Also by stepping back, it may help you organize your thoughts a better way and be able to ask a more concise question.

As a side tip, take time to read How to ask questions the smart way. It may help you organize your thoughts better.
 
Thanks for answering, it's not everytime i post question and i wanted to know what was my error. I give you more information this time (just the little rest of what i don't explain). I tried to post a good question that's containt 2 example descripting what i got in my mind. I also post 3 questions i ask myself and try to understand it (question still on the same problem)
  • Why users desperately want to use ASP-NET or ASP-NET SignalR (web thing)? Still on my main problem (how really work realtime and why everyone use this and not console app)
1658298715963.png
DO YOU THINK I KNOW THAT'S WHY I ASK !!
  • How it works? (I don't found something that's show a minimal reproducible example with the "ConcurrentQueue" using C# for real time applications or explain clearly how it work)
  • I desperately find a way to do EventUpdate that's allow me like every ticks but peoples won't understand. Second solution is to explain a way to do like Windows Defender (where i get the main idea) but change the event
  • 1658298850101.png
    Dude i litteraly explain everything about "real time"


My first example was a simple way to recreate what i was waiting:


first example:
    void ThisIsInRealTime()
    {
        if(open)
          close();
    }


The second explain the same example but with my main idea: And if you don't understand this, I will resume this like "How Windows defender Real Time analysis work".

Can you tell me what did i do wrong i littraly add all my search, they want me to "Update the question so it focuses on one problem only" BUT IT DESCRIBE THE ENTIER PROBLEM

Hope you can help i don't know how to describe more better my question.
 
Last edited by a moderator:
Part of the issue here is that you are not realizing that even though the words "real time" are used, they actually mean different things in different contexts.

SignalR is called "real time" because in traditional web applications, the client has to poll the server so that it can find out if anything has changed. What is revolutionary (?) with SignalR is that it provides a simplified framework for the server to notify the client(s) of changes on the server without the clients having to explicitly poll.

Similarly, traditional console apps are dependent on the user having to press "Enter" to send inputs to the app. They normally don't check the current state of the keyboard, because traditional console APIs don't offer that ability due to their legacy of having to run over teletype machines and older technologies which are line based, not character based. E.g. Data is sent when the user at one end presses the "Enter" or "Return" key, not like what is depicted in the movies, where as one person is typing on the terminal, the letters are showing up on the remote teletype at the same pace as the user is typing.

In the context of virus checkers, the traditional virus checkers had to be manually invoked, or ran on a schedule. Originally, there was no "real time virus checking" where programs where checked as they were launched, and files were checked as they were being read and/or written.
 

Latest posts

Back
Top Bottom