Solved

Application run over network causing problems....

Posted on 2001-06-22
20
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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