473,837 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get return value from a spawned process?

Hi,

I have the following scenarios: client/server programs implemented with
winsock are installed on all systems inthe network (assume it contains s1,
s2, and s3, and other systems). If I send a command from s0 client to s1
server, which ask s1 server to execute a command line of s1 client to talk
with s2 server, s2 server will return value (error code in my case) to s1
client. My question is how I can get the returned value on s0?

The command line execution on s1 is realized by calling system(), to which I
pass the client program name (the client program will returns error code),
and the processed data from s0, but system() only return -1 or 0 to indicate
error or succeed. I also looked at CreateProcess() , but still couldn't see
how I can get the returned value from client execution.

Anybody got idea?

Thanks,
Peter
Jul 22 '05 #1
1 1997
"Peter" <yb***@yahoo.co m> wrote...
I have the following scenarios: client/server programs implemented with
winsock are installed on all systems inthe network (assume it contains s1,
s2, and s3, and other systems). If I send a command from s0 client to s1
server, which ask s1 server to execute a command line of s1 client to talk
with s2 server, s2 server will return value (error code in my case) to s1
client. My question is how I can get the returned value on s0?

The command line execution on s1 is realized by calling system(), to which I pass the client program name (the client program will returns error code),
and the processed data from s0, but system() only return -1 or 0 to indicate error or succeed. I also looked at CreateProcess() , but still couldn't see
how I can get the returned value from client execution.

Anybody got idea?


Since we can only suggest solutions that are or can be written in the
Standard C++, my only suggestion is to create a file with all the return
codes you want.

The rest is off-topic.

Victor
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
6880
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new sockets to a spawned process. Is it possible, and if so how? Any help is much appreciated!! Mike
6
9178
by: news.microsoft.com | last post by:
I have a very multi-threaded Windows Forms application. There are many BeginInvoke calls, as well as Thread/ThreadStarts. My issue is that when I quit my application there are often threads hanging around that prevent the process from dying. I've gone through my code line by line looking for orphaned threads, but I'm unable to figure out where they are being created. Is there any way to kill all threads spawned by a process without...
6
22519
by: Zeya | last post by:
I am developing a ASP.Net(Web) based deployment tool, which requires XCOPY functionality. Here is the code for the method: public static int ExecuteProcess ( string ProcessName, string ProcessArguments ) { string ErrorStream = ""; Process DOSProcess = new Process();
4
1629
by: Kevin | last post by:
I have an application that handles datascraping with a TN3270 session. The TN3270 session is opened with a .ws profile and pcomstrt.exe. The process string in the application is this: psSession = New Process psSession.StartInfo.FileName = path\to\pcomstrt.exe psSession.StartInfo.Arguments = "/P="path\to\ws file & " /S=X /Q" The /P specifies the .ws file to load, the /S=X specifies that the session letter should be X, and i forgot what...
1
3772
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a C# application in which I start another process which produces output to stdout and stderr. In fact, that process is the uSoft VS2005 C/C++ compiler itself! I would like to capture the results of the compile and display them in a RichTextBox. The problem I'm having is that when I intentionally introduce an error in the C code I'm compiling, I can't read the error output in my C# program. I've tried redirecting both...
1
1789
by: Vishal Sethia | last post by:
Just trying to understand the behaviour of spawn. Consider I have a function which creates two threads. And in one of the threads I make a call to pexpect.spawn. spawn would fork and create a new new child In this case who becomes the owner of this child process. Is it the thread that spawned becomes the owner or is the main program becomes the owner of that child process. Thanks, -V
0
1307
by: loorthu | last post by:
I am noticing that pexpect kills any child that it is spawned when the parent is terminated using SIGINT (e.g Ctrl-C on the shell), but not when it is killed by SIGKILL (e.g 'kill -9' on the parent process). Here is a quick demo (tried on Linux 2.6.9 kernel): #!/usr/local/bin/python import pexpect, re
2
3510
by: subrahmanya | last post by:
Hi All Does any one has idea about how to set stdout and stderr to a spawned process? I don't want to have all the handles of the parent process in the child process but I want only one of it (handle to a file). If I inherit all the handles of the parent process my application won't work. So I am spawning a process without inheriting the handles but I am inheriting environment variables. Later I take the PID of the
4
2447
by: A Nonymous | last post by:
I am trying to implement a web updater for my C# application. I am using a technique I have used for several years in Win32 apps but it isn't working for the .NET version of my app. This is my process: 1. My app retrieves a version file form our web server and compares the version to the version of the current assembly. Works fine. 2. If an update is available, I download the new Setup.exe from the web server and save it in a folder...
0
9691
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,...
0
10582
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10280
tracyyun
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...
0
9418
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7821
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7009
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();...
0
5677
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...
0
5859
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4480
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.