Solved

Application run over network causing problems....

Posted on 2001-06-22
20
141 Views
Last Modified: 2010-04-06
Hi.

I have a client/server setup going on with a few applications.  The first application, the client, sends a message to the server application which does loads of stuff on another PC (not really relevant what it does), and then creates an output file.  Then, the viewer program is run on the client machine so that they can see the output.

The problem I have is that the "resources" are apparently still connected to the "client" machine.  (I should have mentioned that the client side software is all stored in a public directory on a seperate networked PC.)

For example, if I try to delete the viewer application, it won't let me, as if the program is still running.  But, if I view the "open resources" in the "control panel/server" applet, it shows the physical connections are still there.

I don't want every user to remain connected after they have used the software.

This is quite a serious issue and I need some help getting round it.  I'm not sure if the Delphi area is the best place to ask, but I'd prefer to solve the problem programatically, from within the software.

Thanks for any help,

John.
0
Comment
Question by:Jaymol
  • 10
  • 7
  • 2
  • +1
20 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6217930
Maybe you can make a local copy of the viewer application before running...
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6218004
This sounds like a server problem. You say that the viewer application is closed, but the .exe file remains open, right?
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218034
It's the physical connection to the machine which holds the client & viewing software that's the problem.

This remains, even though the app(s) are closed.

John.
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6218036
btw, I red somewhere in the MSDN (oh, somewhere in the MSDN!) that Microsoft recomends Excel to be started localy, because there is a problem if it is started from a server. The program itself looses the connection with the .exe file in the remote machine or something like that. Haveing local copy of the viewer is realy a good idea.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218039
Btw, I have checked the process list (NT4) and the apps are definately closed.

John.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218042
I'll try copying it locally 1st.

Ta.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6218056
Hi,
I'm afraid that it is a global NT problem. After some time of inactivity (undefined period - I have seen it for days), the NT will refresh its resources usage and will free them and disconnect the users. Moving the program to the client PC will not help you (the resources on the server will remain in use). The only way to do this from the remote PC, I've reached, is to disconnect the shared drive and connect it again.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218061
Thanks Geo, but if there's a button in the server applet that allows you to disconnect users, then there must be a way to do it programatically, therefore allowing me to disconnect a user, via the server application, once it knows the user is done.

Thanks,

John.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6218062
If you copy the program and the files it uses locally, it will solve the problem. Do not open them remotely using a local program.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218069
The files have to be available remotely as there are so many/they're so big.

John.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 17

Expert Comment

by:geobul
ID: 6218127
How could you know that the user has finished while the connection is still active? Such a program should be running on the server (as a service for example) and to disconnect users after a predefined idle period has been reached. But I have no code for doing this.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218131
The server application runs a process and then tells the client that it's done.  Therefore, the server knows it can close the connection before the client.

All I need now is to know how to close the connection.

John.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6218208
Take a look at NetSessionEnum and NetSessionDel API functions.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6218229
I will.

Ta,

John.
0
 
LVL 17

Accepted Solution

by:
geobul earned 300 total points
ID: 6218372
Hi John,

procedure TForm1.Button1Click(Sender: TObject);
var TheDll : dword;
    NetSessionDel : function (server, client, user: pWideChar) : dword; stdcall;
    res : dword;
    sWide : PWideChar;
    sWideLen : integer;
begin
  TheDll := LoadLibrary('netapi32.dll');
  NetSessionDel := GetProcAddress(TheDll, 'NetSessionDel');
  sWide := StringToWideChar(Edit1.Text,sWide,sWideLen);
  res := NetSessionDel(nil,nil,sWide);
  FreeLibrary(TheDll);
end;

// tested on NT4 server. Receives the user name from an edit box and closes his all connections.

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 6231966
Hi John,

Have you tested my last code? I forgot to say that the user name should not include the domain name and a slash.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6234181
Sorry Geo, I haven't had chance yet.

I'll give it a go today and get back to you.

John.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6234277
Don't bother yourself. I have nowhere to hurry on. I was afraid that you hadn't seen it.

Regards, Geo
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6234283
Ok.  Ta.

John.
0
 
LVL 6

Author Comment

by:Jaymol
ID: 6276146
Thanks for your help.

John.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now