Solved

Application run over network causing problems....

Posted on 2001-06-22
20
143 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

12 Experts available now in Live!

Get 1:1 Help Now