c# notify a running process [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to somehow notify a running process from the "outside"?
I have a C# program that theoretical runs forever. And I would like to notify it to trigger some action manually. It would be best, if this solution is possible on Windows and Linux (mono).
EDIT:
The solution should work without a user interface
My program is, as for now, a part of web service. On initializing, a new Theread is created, which uses the Task class to stay alive

Take your forever-running-process and let it provide a webservice other processes can call.
You might use any cross-plattform webservice framework like WebApi or ServiceStack to achieve this via HTTP calls. This will even work over the internet (if the machines can reach each other).
There are dozens of approaches. You could also use named pipes for example, or put commands into a database (the other process has to query regularly) or - if you're fearless enough - write/read files to communicate. Be creative ...

Related

Should I make my application a service or a console application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am planning to write a web server in c# that will run on my computer. I've heard that windows services are good for such tasks because they can start on startup and because they run in the background and don't interfere with your work. The only problem with this is that I would like to see the activity on my web server through a terminal. I don't think services can do this, but it's not a big problem because I'm sure there is a way to make the service run the server and create a separate console application to interface with the server service.
My question is, why bother? Can't I just have a console application run everything and also handle the terminal interface? The only reason I would consider using a service is if it offers some kind of performance boost. Does it?
Windows service - is not about performance boost. Your choice depends on what is the main goal of your service. If it's just an utility app and you plan to start and stop it manually perhaps console app will be good for you, else IMHO you should consider windows service that store logs and/or push events + console/wpf/winforms or any other appropriate kind of application for monitoring purposes.

Re-run c# application after delay of 5 seconds [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
On clicking directly my c# application.exe file, i am running my application and its process in task manager appears if that process on certain condition kills my application stops. What i want is to re run the application after delay of 5 seconds by it self.
You cannot. That process is gone. What you can do is start a second process with you first, most commonly called a "watchdog" or "guard", to scan for your first process and if it does not find it, start it. It's not foolproof though, somebody could just as easily kill that process, too. It's just another layer.
Advice on how to implement that is far to broad for this format, I suggest you read some good articles on it, try to implement it and come here when you find yourself stuck at a specific problem.
Although my answer might not be that helpful, and also this question isn't a kind related to coding issues, but I suppose, using Windows Task Scheduler might work out for you, as you can add various triggers to your application and repeat your task after any set amount of time.
Hope it helps. Thanks

What is the difference between the Ping and WebClient classes in C# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I was looking for ways to check and report the status of a webservice, and came across both these classes. Is there any benefit in using one of these over the other?
Ping tells you whether a machine is accessible.
WebClient allows you to make HTTP (web) requests.
You almost certainly want the latter. Or consider HttpClient - https://msdn.microsoft.com/en-us/library/system.net.http.httpclient(v=vs.118).aspx .
You may find https://stackoverflow.com/a/7523808/34092 useful as well.
Ping sends ICMP echo requests to the target machine. Many machines will not respond to these requests because firewalls. So this is an unreliable means of checking if a machine is running, let alone running the service you're interested in connecting to.
The best way to check if a service is running is to try and use it (without any kind of pre-check) in the way that the service provider intends you to use it. If it doesn't work, then you can safely say that the service is down.

C#, remote screenshot without client and server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I just tried a program demonstrated in C# on YouTube. The video shows how to build a client/server based program to capture desktop remotely, and it works perfectly. Now I have a question. Is is possible to do the same job without the client/server architecture? Is there some kind of relative windows API that I can access remotely? My imagination is just to click a button on computer A(with specific program) and receive a screenshot from computer B(without specific program) through network. Is is possible? Thank you very much!
The thing is, that when you access "some API" remotely and get result from that "some API" it's called a client / server architecture, where you is a client and "some API" is a server.
You can't receive something if there is no one to give))
If you wanted to ask "is there anything in windows that would give me a screenshot without injecting anything and etc?" - then:
if you don't care about laws, theoretically, you could find some bug in system itself or applications that are running on it, and through them get access to that computer and make it do whatever you want, that's called hacking, the very black hacking, and that type of things are hard to do.
if you care just a little about any of laws and don't want to visit a prison, then the answer is no.

Trying to build an OnSIP compatible softphone in C# WPF [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I work for a small Point of Sale Company, and we are working on a in-house tool to make our lives easier when it comes to ticketing and troubleshooting. Part of my task in this tool is to write a 'softphone' in C# WPF that we can use to accept incoming and make ongoing calls with.
We currently use OnSIP as our SIP provider, and are looking to build custom software to essentially allow us to auto-generate support tickets based on the phone number of the incoming call. In addition we will need call transferring, recording, hold/wait, etc.
The question that seems to be causing me the most trouble is really where to begin on something like this. Thoughts?
I'm presuming this is a desktop application?
Lookup pjsip.org, it's a portable C library which is very well proven. It will allow you to do all that you are asking, although it'll take you some time to write the wrapper code - you can find examples on the internet, however we have written a wrapper ourselves which I'll check on as we had intended open sourcing it. This is because when we did this last year, the examples just didn't work too well :-)

Categories

Resources