473,748 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to: run some logic in a seperate process - not thread?

In our VB.Net application, we need to be able to start
another process (thread won't do it) and run some logic in
it, and still be able to communicate with the main
process. Is this possible and how to do it?

Thanks
Nov 20 '05 #1
8 2981
Hi Fenh,

Another process means another application. After that it depends what sort
of communication you want. How much data, how often, etc. All the facilities
that Windows provides are available - there's Windows messages, shared memory,
pipes, sockets, the file system, etc.

Can I ask why threading isn't a solution?

Regards,
Fergus
Nov 20 '05 #2
Hello,

"feng" <li******@msn.c om> schrieb:
In our VB.Net application, we need to be able to start
another process (thread won't do it) and run some logic in
it, and still be able to communicate with the main
process. Is this possible and how to do it?


Why not using an other thread? You can use Remoting to communicate with the
other instance of the application.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
Thanks for your reply.
Our VB.Net app is using an 3rd party component to
communicate with other apps on different plateform. When
using this component (a regular dll, not even COM dll), it
is crital that we have different communication pipe lines
(ports) set up on both sides for each individual calls. In
other words, we don't want the calls to share the same
port. Accroding to the 3rd party component's limit,
unfortunitly, we can only do this by starting this
component in a different process. A different thread just
won't do the job. Not even a different AppDomain.

Any thoughts?

Thanks

-----Original Message-----
Hi Fenh,

Another process means another application. After that it depends what sortof communication you want. How much data, how often, etc. All the facilitiesthat Windows provides are available - there's Windows messages, shared memory,pipes, sockets, the file system, etc.

Can I ask why threading isn't a solution?

Regards,
Fergus
.

Nov 20 '05 #4
Hi Feng,

|| Our VB.Net app is using an 3rd party component to
|| communicate with other apps on different plateform.

You've got a App with a 3rd party component. which communicates with
remote applications through ports. That's as far as I understand then I'm
uncertain. So I have to ask more questions.

|| When using this component (a regular dll, not even COM dll),
|| it is crital that we have different communication pipe lines
|| (ports) set up on both sides for each individual call.

That's ok. What protocol are you using, out of interest?

|| In other words, we don't want the calls to share the
|| same port.

Is there a difficulty in selecting ports?

|| Accroding to the 3rd party component's limit,
|| unfortunitly, we can only do this by starting this
|| component in a different process.

I don't understand why, but different processes is ok. That just means
several copies of your program running simultaneously.

|| A different thread just won't do the job.

Any idea why?

|| Not even a different AppDomain.

What do you mean by an AppDomain?
Are you saying that the component can only do one 'pipe line' per
application ? or has some small limit?
How many pipe lines do you need to set up? How many can the component
handle at any one time? Does it need specific ports?

You'll have to have several copies of your program running at the same
time. Have you any idea what they will need to tell each other in order to
work together ?

Hopefully your answers to these questions will lead us towards getting a
solution for you. :-)

Regards,
Fergus
Nov 20 '05 #5
Hi Feng,

|| It's interesting that I got another reply email with those
|| qustions from you in my personal mailbox but I don't see
|| it here.

I'm not sure what that's about, I checked my Sent folder to see if I
posted to you personally by mistake but there's nothing there. Nor have you
been added to my address book. It's mystery time.

Let's see if I now understand the situation. This is more for me, as I
read your mail, than for you so bear with me.

=============== =============== ======
Ok we have a remote COBOL back-end [as remote as possible, please!! ;-)].

To speak to it you have a 3rd-party rpcCobol dll wrapped by a COM
component (rcpWrapper, say).

This can be hosted inside an application and will provide it with a single
TCP/IP port and no more.

You can't have more than one instance because it's a plain old-fashioned
dll. Multiple instances of rcpWrapper will not get discrete instances of
rpcCobol data.

Having two or more instances of your <application> is fine, however. Each
gets its own TCP/IP port because each provides its own address space to
rpcCobol.

Within your application are multiple sub-programs - 'users' of the Cobol
back-end, which require their own connection, ie. their own port.

These 'users' must co-exist within a given appliaction.

rpcCobol's restriction to one port is a stopping point.

Threads are not a solution because they are in the same address space
sharing the same dll.

Processes is the way to go.

Yes. It's all perfectly clear.

[Except for Application Domain which is a term I don't know]
Correction, I've just read it up and it's not a solution for the same
reason as Threads. Application Domains provide a .NET/CLR separation but still
within the same address space. [In fact that latter point is one of the
benefits of Application Domains, as I understand it.]

=============== =============== ======

What if you rewrite your COM wrapper as an application with an Automation
interface rather than as a component? Then each sub-program can create its own
instance of "appRpcWrap per" which can provide the rpcCobol dll with a separate
address space. It would also make communication easy as you'd be able to
define whatever functions and methods you want and let Interop manage the
to-and-fro.

If that's not a solution, then you'd have to write a standard exe which
would simply host an rpcCobol - and devise another method of communication.
The choice then would depend upon what data you'd need to pass between them,
and how much and how often, etc.

I hope this helps.

Regards,
Fergus
Nov 20 '05 #6
feng,
Based on your's & Fergus's discussion I would do as Herfried suggested. Use
..NET remoting.

Each instance of the DLL would need to be started by an individual
executable as you stated.

I would consider having 2 executables. One that hosted the DLL, which would
be a .NET Remoting Server, and a second that 'hosted' the first executable.
It would be a .NET Remoting Client.

One instance of the 2nd executable would start multiple instances of the
first executable. I would use a collection (in the second) to keep track of
the instances of the first application. The first can raise events (via
remoting) to notify the second of things.

Matthew MacDonald's book "Microsoft Visual Basic .NET Programmer's Cookbook"
from MS Press has some simple examples on using .NET Remoting.

Hope this helps
Jay

"feng" <li******@msn.c om> wrote in message
news:01******** *************** *****@phx.gbl.. .
In our VB.Net application, we need to be able to start
another process (thread won't do it) and run some logic in
it, and still be able to communicate with the main
process. Is this possible and how to do it?

Thanks

Nov 20 '05 #7
Fergus,
I tend to think of Automation as a COM (VB6) term, while .NET Remoting is a
..NET term.

In other words .NET Remoting is how you do Automation in .NET.

Other than the book I referenced I do not have any other good references on
Remoting.

Hope this helps
Jay

"Fergus Cooney" <fi******@tesco .net> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Hi Jay,

Thanks. :-)

What's the advantage of .NET Remoting overAutomation (bearing in mind that I know very little about Remoting) ?

Regards,
Fergus

Nov 20 '05 #8
Hi Jay,

Thanks - it's an area that I haven't looked at yet.

One area.

Out of a thousand :-(

Lol. :-)

Regards,
Fergus
Nov 20 '05 #9

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

Similar topics

2
2263
by: mwazir | last post by:
Hi all, I have reposted this question from dotnet.general as I have been advised that this is a more appropriate forum for this question. Apologies for the repost. I have a process thats starts in my application and only terminates when my application is terminated. I want to write the output and the errors of this process to a seperate log file. In order to do this, I spawned two threads.
3
5139
by: belgiozen | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while the executable(MYPROGRAM.EXE) is running,it will wait for a time(about 20 seconds) for the main windows thread to abort.If it does not finish its work, the...
2
2279
by: mwazir | last post by:
Hi all, I have a process thats starts in my application and only terminates when my application is terminated. I want to write the output and the errors of this process to a seperate log file. In order to do this, I spawned two threads. My code looks something like this ' Starting the process oProcessStartInfo = New ProcessStartInfo()
3
2285
by: daan | last post by:
Hello, I have a problem and I can't get the solution for it :( I have a com dll, which i imported as a reference. The com object is part of a class which is multithreaded and will create seperate objects which we can and must control. On these com objects I added the events via AddHandler. This is working great, I can see that my threads are raising events through the com object.
9
12313
by: anders | last post by:
I am writing a plugin for a piece of software in python, and I want to start up a PyQt GUI in the plugin, without stalling the main thread while the gui is running (later i will want to pass messages between the main thread and the gui thread). I'm new to pyqt, so I'm probably doing something very silly, but for the moment I'm just trying to get the first pyqt tutorial example running in a seperate thread: ----8<--------
15
2579
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
5
6028
by: salberts | last post by:
Hi, I am writing an application that has its UI and Logic layers. My initial idea was to launch the two layers on two different threads and manage calls made by the UI to the Logic manually. Which means handling the Sleep/Wakeup of the logic thread all by myself. This looks reasonable to me in the way that the UI and the Logic run separately and only send messages to each other. The main disadvantage of thos method is that I have to...
2
1688
by: =?Utf-8?B?UG1hX1NoYW5l?= | last post by:
I am wring asp webservices in managed c++ for IIS 5.1 runing on XP SP2. Even though I set the aplication protection to High (Isolated), each service seems to run in the same process. I wrote a couple of test servies in c# which reurned the process id and got the same results. The process they run in has the same id as aspnet_wp.exe of which there is only one instance running. How can I get each application to run in a seperate process?
2
3855
by: Jorgen Bodde | last post by:
Hi all, I want to make a small batch copy tool that scans for certain files, and copies them to a specified directory. Since the files are huge (AVI / DIVX) typical 300 to 700 Mb, I want to provide the user with some feedback during the file copy. Here is my dillemma; When I use shutil.move(..,..) I have to wait until it's done, there is no feedback, so the GUI basically hangs. However, shutil.move can be fast because it intelligently...
0
9552
Oralloy
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...
1
9326
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,...
0
9249
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
8245
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
6796
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
6076
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
4607
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...
1
3315
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
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.