Hi,
I have a console app that I want to stop gracefully by another program. The
console app already has code to intercept control-c and logoff and so on.
But how do I send a control-c to that console app from another program? The
console application is started with a Process class.
Thanks
Frank 7 8421
Frank,
Why not expose a remoting endpoint which would have a method which will
call Exit on the Environment class?
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Frank" <fr***@frank.co m> wrote in message
news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Hi,
The Console app can expose several ways to communicate with it , like :
1- TCP port
2- Named piped
3- Remoting
Any of these can be used to send a "terminate" signal , then you can call
Environment.Exi t or Process.Kill to force it to terminate, or do as needed
to gracefully terminate it.
In case you do not have access to modify the app you could use
Process.Standar dInput to send a ctrl+c to the app
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Frank" <fr***@frank.co m> wrote in message
news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Sending ctrl+c to standardinput does not seem to work. I don't know why not.
thanks
Frank
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
schreef in bericht news:O9******** ********@tk2msf tngp13.phx.gbl. .. Hi,
The Console app can expose several ways to communicate with it , like : 1- TCP port 2- Named piped 3- Remoting
Any of these can be used to send a "terminate" signal , then you can call Environment.Exi t or Process.Kill to force it to terminate, or do as needed to gracefully terminate it.
In case you do not have access to modify the app you could use Process.Standar dInput to send a ctrl+c to the app
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Frank" <fr***@frank.co m> wrote in message news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Yes, thats on my list
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> schreef
in bericht news:e%******** ********@TK2MSF TNGP11.phx.gbl. .. Frank,
Why not expose a remoting endpoint which would have a method which will call Exit on the Environment class?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Frank" <fr***@frank.co m> wrote in message news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Hi,
Does it works if you send any other character?
maybe you are not sending the correct sequence.
what about the other options I presented you with?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Frank" <fr***@frank.co m> wrote in message
news:do******** **@news4.zwoll1 .ov.home.nl... Sending ctrl+c to standardinput does not seem to work. I don't know why not. thanks Frank
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > schreef in bericht news:O9******** ********@tk2msf tngp13.phx.gbl. .. Hi,
The Console app can expose several ways to communicate with it , like : 1- TCP port 2- Named piped 3- Remoting
Any of these can be used to send a "terminate" signal , then you can call Environment.Exi t or Process.Kill to force it to terminate, or do as needed to gracefully terminate it.
In case you do not have access to modify the app you could use Process.Standar dInput to send a ctrl+c to the app
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Frank" <fr***@frank.co m> wrote in message news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Hello,
I am sending a hex 3.
The console app does not have a read in it.
Don't need to, if I do a ctrl-c or close the window with the X in the
topright corner it stops gracefully.
Regards
Frank
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
schreef in bericht news:eA******** ******@TK2MSFTN GP14.phx.gbl... Hi,
Does it works if you send any other character?
maybe you are not sending the correct sequence.
what about the other options I presented you with?
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Frank" <fr***@frank.co m> wrote in message news:do******** **@news4.zwoll1 .ov.home.nl... Sending ctrl+c to standardinput does not seem to work. I don't know why not. thanks Frank
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > schreef in bericht news:O9******** ********@tk2msf tngp13.phx.gbl. .. Hi,
The Console app can expose several ways to communicate with it , like : 1- TCP port 2- Named piped 3- Remoting
Any of these can be used to send a "terminate" signal , then you can call Environment.Exi t or Process.Kill to force it to terminate, or do as needed to gracefully terminate it.
In case you do not have access to modify the app you could use Process.Standar dInput to send a ctrl+c to the app
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Frank" <fr***@frank.co m> wrote in message news:do******** **@news6.zwoll1 .ov.home.nl... Hi, I have a console app that I want to stop gracefully by another program. The console app already has code to intercept control-c and logoff and so on. But how do I send a control-c to that console app from another program? The console application is started with a Process class.
Thanks Frank
Hi,
Well, what about a Process.Kill ?
Not very gracefully, but ... :)
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Frank" <fr***@frank.co m> wrote in message
news:do******** **@news2.zwoll1 .ov.home.nl... Hello, I am sending a hex 3. The console app does not have a read in it. Don't need to, if I do a ctrl-c or close the window with the X in the topright corner it stops gracefully. Regards Frank "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > schreef in bericht news:eA******** ******@TK2MSFTN GP14.phx.gbl... Hi,
Does it works if you send any other character?
maybe you are not sending the correct sequence.
what about the other options I presented you with?
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Frank" <fr***@frank.co m> wrote in message news:do******** **@news4.zwoll1 .ov.home.nl... Sending ctrl+c to standardinput does not seem to work. I don't know why not. thanks Frank
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > schreef in bericht news:O9******** ********@tk2msf tngp13.phx.gbl. .. Hi,
The Console app can expose several ways to communicate with it , like : 1- TCP port 2- Named piped 3- Remoting
Any of these can be used to send a "terminate" signal , then you can call Environment.Exi t or Process.Kill to force it to terminate, or do as needed to gracefully terminate it.
In case you do not have access to modify the app you could use Process.Standar dInput to send a ctrl+c to the app
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Frank" <fr***@frank.co m> wrote in message news:do******** **@news6.zwoll1 .ov.home.nl... > Hi, > I have a console app that I want to stop gracefully by another > program. The console app already has code to intercept control-c and > logoff and so on. But how do I send a control-c to that console app > from another program? The console application is started with a > Process class. > > Thanks > Frank >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: KB |
last post by:
Hi,
I want to write a Python script that controls and automates a Windows
GUI computation program.
My problem is that I do not know how to quit the Windows GUI program
gracefully with a command (program's or Python) in Cygwin. 'kill' or
CTRL-C command in Cygwin does not finish it gracefully, meaning that
some outputs do not come out normally. The only thing I know is to
click 'File-Exit' menu, but
|
by: Gary |
last post by:
Hi, there,
I have an application running on remote machine, and would like to close it
gracefully. Like a human go to there, push the stop button, and close it
after several seconds.
How to implement that in C#? Any suggestion?
Thanks lot,
Gary
|
by: William F. Robertson, Jr. |
last post by:
One of my developers came to me with this question and I don't have an
answer for them. The only suggestion I had for them was to change the
return to a output parameter and put a try catch around it and look for the
output parameter to have a value.
I would have thought this should have been posted in the sql newgroups, but
I know exactly what they would say, and they would be correct.
But when using asp.net ado.net command object. I...
|
by: - Steve - |
last post by:
I'm using Forms Based Authentication.
I've written my code so that when a user does something but has timed out,
it gracefully logs them out and asks them to log back on.
I do this with . .
Session.Abandon()
Response.Redirect("logon.aspx")
|
by: Mark |
last post by:
Hello,
I'm trying to handle HttpRequestValidationException. If a hacker enters
certain values into a textbox, like "<script>", it will trigger this error. I
understand why .Net has this, but I need a way to gracefully handle it.
Ideally the app would catch it as invalid input, and then return control to
the user instead of throwing an exception. This is a problem is a legitimate
user enters it into a long description box as part of a rare,...
| |
by: Tim Chase |
last post by:
While working on a Jumble-esque program, I was trying to get a
string into a character array. Unfortunately, it seems to choke
on the following
import random
s = "abcefg"
random.shuffle(s)
returning
|
by: Philip Pemberton |
last post by:
Hi,
I'm currently playing around with a little spam filter for my Linksys NSLU2
(I would have used Spamassassin but that's slow even on my 2GHz Athlon64 - on
a 266MHz XScale it's likely to be intolerably slow). As part of that, I'm
keeping track of the DNSBL blocklists that are being queried using a
dynamically-allocated array.
When a new DNSBL zone is added to the zone array, I use realloc() to
increase the amount of memory available...
|
by: Jon Davis |
last post by:
Is there such a thing as a Windows standard for killing a console app that
is monitored by a System.Diagnostics.Process object?
I'm hosting several C# console apps in a C# Windows service and would like
to standardize on a graceful termination method when the Windows service
stops.
Jon
|
by: !NoItAll |
last post by:
I have a program that needs to access the files that are open by another program on the computer.
When my application comes up I can easily see if the other application is running with the .net Process.GetProcessesByName method
Dim MyProcesses() as Process = GetProcessesByName("AnApplication")
For Each Instance as Process in MyProcesses
If MsgBox("application is running - do you want to end it?", MsgBoxStyle.YesNo or...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |