Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping Remote .EXE running ?

Status
Not open for further replies.

Bart9140

Programmer
Aug 1, 2001
8
0
0
NL
I have the following problem :

Configuration:
client --> COM --> Buz.dll --> DCOM --> Persistence.exe

Persitence.exe:
In the main module i have the connection to the database (MYConnection).

In the classes within persistence.exe i use the Myconnection.

Everytime a client asks an instance, the main module gets executed and the class does his job.
After that, the persistence.exe stops until another client again asks another instance of a class.

So everytime a client needs something, the database has to be opened wich takes about 10 seconds.

If i add a form tho the persistence.exe witch i show in the main module, the persistence.exe never
stops executing and the main module only gets to be executed once (only for the first client who
starts the persistence.exe).

Is this the wright thing to do ??? and can anyone explain wich threading options i have to use.

Greetings,
Bart
 
Hi Bart,
Depending on what you are trying to do, but , yes, this is correct.

If your client make a DCOM call to your object that resides in EXE, the EXE vanishes after the Reference count to the object is 0. (that means when your client finishes).

if I were you , I may also think using making this component a DLL and registering with MTS. MTS has a resource manager for ODBC calls, so it caches the ODBC connection for a while for future use.

If you don't need to reach the same server object, you should make the threading setting at least to have several threads. If you are sure that there won't be tens of calls at the same time, I would prefer thread per object.
If you want to access the same object, its a different story, but i think this is not the case.

I hope this helps,
Aykut
-----

 
Hy Aykut,

Thanks a lot !

If I know more about MTS, i'll sure try to convert it to a dll and run it in MTS.

If I can ask you some more about the thread-settings ?

In my persistance.exe there are several classes. One of them is "UserPersist" which reads the detailinformation of a user.
If I have 10 clients, they each can browse (in a grid) all the users and by clicking a row, they initiate an instance of the class and ask the data. So as I understand it, a lot of instances of the class "Userpersist" can live on the server (and are executed one by one ???). Each time a client clicks another row, I create a new instance and the former dies.
Is this what you mean by saying "If you want to access the same object" ? I thought that for each client which initiates an instance, a new object gets created on the server until the client does a set x = nothing or creates another with the same variable.

My Persistance.exe has now "thread per object" in its settings.

Please teach me.
 
Dear Open a Global Connection Object so Whenever Hits Comes To ur EXE Instead of Opening new COnnection Just Refer to That Connection.

happy Programming

Manu
 
To keep the Connection opne What I did is I add a form to the Active X Exe. I loaded the form in the module and set the threading to be pooled to 16.
Now when the request comes from the client one by one all the threads are activated and keeps the database connections(Or other connection) open.
When all the threads are activated I got 16 exe forms running in the task bar but only one exe runs in the task manager.

I used this solution for keeping the coonection with an TCP remote server and it worked well

Manoj Happy Programing
 
>>Is this the wright thing to do ???
No, this is not the right way to do.

You can't have UI objects on remote machines. Well, actually you can, but you'll have to DCOMCFG the server in such a way that the server runs as the interactive user. You do not want this, as a user with sufficient rights to do all your app needs to do must always be logge in. Also, when using connection points, you'll have to configure DCOM on the server in such a way that security risks are at the highest.


Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top