For Programmers: Free Programming Magazines  


Home > Archive > Clipper > February 2006 > Clipper app in win2k/XP needs to reconnect network drive









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Clipper app in win2k/XP needs to reconnect network drive
Dale Davis

2006-02-09, 6:55 pm

I have a clipper app running in a win2k/xp environment that is having
problems writting to a network drive. The app writes to a network drive
which can disconnect and reconnect. When the drive reconnects Windows
reports the drive as "disconnected" until accessed by Windows Explorer. How
can my Clipper app "reconnect" this drive?


Robert J. Stuart

2006-02-10, 3:55 am

Dale, not sure if there is an easier way to do this, but I have the same
problem. Not only with windows networking, but I also use Lantastic V8 for
my dos only machines. Here too if the workstation gets disconnected from
the network for even a few seconds, all mapped drives go away. So I wrote
an error trap when accessing network drives.

First I test a know file for existence on the drive. Let's say my mapped
drive is F:. And the file name I am using is WORK.

FNAME="F:\WORK"
IF .NOT. FILE(FNAME)
ERRTRAP1()
ENDIF

I also set up the same error trap when actually opening the database for
use.

SELECT 1
USE &FNAME ALIAS WORK
IF NETERR()
ERRTRAP()
ENDIF

Now my error trap simply runs the windows net use command to first
disconnect the mapped drive, then reconnect it again. You can even call a
batch file to do this.

NET USE F: /DELETE
NET USE F: \\MAIN\C

Now loop back thru and test to see if your file name exists, which it should
if your network is working right.

Bob S.



"Dale Davis" <daledavis3@cox.net> wrote in message
news:yNQGf.16092$ZA5.14346@fed1read05...
> I have a clipper app running in a win2k/xp environment that is having
> problems writting to a network drive. The app writes to a network drive
> which can disconnect and reconnect. When the drive reconnects Windows
> reports the drive as "disconnected" until accessed by Windows Explorer.

How
> can my Clipper app "reconnect" this drive?
>
>



Ross McKenzie

2006-02-10, 3:55 am

On Fri, 10 Feb 2006 07:35:59 GMT, "Robert J. Stuart"
<rjstuart@earthlink.net> wrote:

>Dale, not sure if there is an easier way to do this, but I have the same
>problem. Not only with windows networking, but I also use Lantastic V8 for
>my dos only machines. Here too if the workstation gets disconnected from
>the network for even a few seconds, all mapped drives go away. So I wrote
>an error trap when accessing network drives.
>
>First I test a know file for existence on the drive. Let's say my mapped
>drive is F:. And the file name I am using is WORK.
>
>FNAME="F:\WORK"
>IF .NOT. FILE(FNAME)
> ERRTRAP1()
>ENDIF
>
>I also set up the same error trap when actually opening the database for
>use.
>
>SELECT 1
>USE &FNAME ALIAS WORK
>IF NETERR()
> ERRTRAP()
>ENDIF
>
>Now my error trap simply runs the windows net use command to first
>disconnect the mapped drive, then reconnect it again. You can even call a
>batch file to do this.
>
>NET USE F: /DELETE
>NET USE F: \\MAIN\C
>
>Now loop back thru and test to see if your file name exists, which it should
>if your network is working right.
>
>Bob S.


Hi Bob.

This suggestion gets my vote for idea of the month. Simple and elegant
solution to a real life problem. Thanks.

Regards,

Ross McKenzie
ValuSoft
Melbourne Australia

valusoft AT optusnet DOT com DOT au
Nick Ramsay

2006-02-10, 3:55 am

On Thu, 9 Feb 2006 16:06:10 -0800, "Dale Davis" <daledavis3@cox.net>
wrote:

>I have a clipper app running in a win2k/xp environment that is having
>problems writting to a network drive. The app writes to a network drive
>which can disconnect and reconnect. When the drive reconnects Windows
>reports the drive as "disconnected" until accessed by Windows Explorer. How
>can my Clipper app "reconnect" this drive?
>


Covered in the VFAQ:

* I'm using a MS Windows server and I'm getting "DOS error 55",
"corruption detected", "DBFNTX/1038 lock failure", "disappearing
network drives" or similar issues. What can I do?

Short answer:
<URL:http://www.witzendcs.co.uk/html/nt_networking.html>
Dave P

2006-02-10, 6:55 pm

in startup or registery or a simple batch file when u start your clipper app
myapp.bat
net use x: \\computer\share /DELETE
net use x \\computer\share /PERSISTENT:YES
IF EXIST X:\MYEXE.EXE GOTO RUN ELSE GOTO END
:RUN
MYEXE.EXE
:END
ECHO DRIVE NO VALID

somthing like the above



"Dale Davis" <daledavis3@cox.net> wrote in message
news:yNQGf.16092$ZA5.14346@fed1read05...
> I have a clipper app running in a win2k/xp environment that is having
> problems writting to a network drive. The app writes to a network drive
> which can disconnect and reconnect. When the drive reconnects Windows
> reports the drive as "disconnected" until accessed by Windows Explorer.

How
> can my Clipper app "reconnect" this drive?
>
>



Robert J. Stuart

2006-02-11, 6:55 pm

Thanks Ross, that's me, simple. I have been using this since my first
experience with networks and Clipper going back to the late 80's. In the
beginning, I used a network O/S called Vianet by Western Digital. This had
a nasty habit of disconnecting all the time.

Bob S.



"Ross McKenzie" <NoJunk_valusoft@optusnet.com.au> wrote in message
news:43ec5a3f.18080093@news...
> On Fri, 10 Feb 2006 07:35:59 GMT, "Robert J. Stuart"
> <rjstuart@earthlink.net> wrote:
>
for[color=darkred]
wrote[color=darkred]
a[color=darkred]
should[color=darkred]
>
> Hi Bob.
>
> This suggestion gets my vote for idea of the month. Simple and elegant
> solution to a real life problem. Thanks.
>
> Regards,
>
> Ross McKenzie
> ValuSoft
> Melbourne Australia
>
> valusoft AT optusnet DOT com DOT au



Klas Engwall

2006-02-12, 7:55 am

Bob,

>Thanks Ross, that's me, simple. I have been using this since my first
>experience with networks and Clipper going back to the late 80's. In the
>beginning, I used a network O/S called Vianet by Western Digital. This had
>a nasty habit of disconnecting all the time.


Monitoring the problem and reconnecting the drive when needed is one
way to keep the application running without interruption (BTW, my
LanMan Library will do it from inside the app instead of relying on
external resources). Another way is to stop Windows from disconnecting
in the first place.

There is a registry setting called AutoDisconnect which is set to drop
the network connections after a certain time. Disabling that setting
will solve the problem once and for all. In another message in this
thread Nick Ramsay posted a link to a web page where he discusses a
number of network related problems and offers a couple of .reg files
that have proven very useful for dealing with those problems.

Besides dropped network connections these settings deal with such
things as opportunistic locking and caching of open files that an
application has already closed. All these things affect Clipper apps,
and they have been discussed here numerous times over the years. A
visit to Nick's web site is highly recommended for all Clipper
programmers.

Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Robert J. Stuart

2006-02-12, 6:55 pm

Klas, my main reason for the error trap is that most of my applications run
on non windows machines. I am still using over 70 dos only computers. I
use Lantastic V8 for my networking O/S back to a Win2K server, actually
several servers. The one problem with Lantastic is that it too drops
network connections. This is not by design as a time out like in windows,
but a flaw in the network O/S. So my work around all these years has been
my little error trap. Although I have experienced some network
disconnections of drives and printers on my windows computers, the error
trap seems to work there too.

I know there is some network tweaking in the registry for windows, but just
never seem to find the time to play around with it to find the best settings
for my applications. I do agree with you that for a windows networking
problem, finding the right registry settings would be preferable.

Bob S.


"Klas Engwall" <klas.engwall@nospam.please> wrote in message
news:43ef1d5e.675996671@news.wineasy.se...
> Bob,
>
had[color=darkred]
>
> Monitoring the problem and reconnecting the drive when needed is one
> way to keep the application running without interruption (BTW, my
> LanMan Library will do it from inside the app instead of relying on
> external resources). Another way is to stop Windows from disconnecting
> in the first place.
>
> There is a registry setting called AutoDisconnect which is set to drop
> the network connections after a certain time. Disabling that setting
> will solve the problem once and for all. In another message in this
> thread Nick Ramsay posted a link to a web page where he discusses a
> number of network related problems and offers a couple of .reg files
> that have proven very useful for dealing with those problems.
>
> Besides dropped network connections these settings deal with such
> things as opportunistic locking and caching of open files that an
> application has already closed. All these things affect Clipper apps,
> and they have been discussed here numerous times over the years. A
> visit to Nick's web site is highly recommended for all Clipper
> programmers.
>
> Klas
>
> -------
> klas dot engwall at engwall dot com
>
> http://www.engwall.com/clipper/
>
> The LFN Library for Clipper
> The LanMan Library for Clipper
> The NFPAT1A Timeslice release patch for the Nanforum Toolkit



Klas Engwall

2006-02-12, 9:55 pm

Bob,

>Klas, my main reason for the error trap is that most of my applications run
>on non windows machines. I am still using over 70 dos only computers. I
>use Lantastic V8 for my networking O/S back to a Win2K server, actually
>several servers.


Wow, that brings back memories of times past <g>. Not from Lantastic,
but I used D-Link LANsmart for many years. Their programmer's
reference manual taught me what I needed to know to write the first
version of the LanMan Library back in the eighties.

>The one problem with Lantastic is that it too drops
>network connections. This is not by design as a time out like in windows,
>but a flaw in the network O/S.


I am sure Bill's people worked really hard to design their flaw <g>

>So my work around all these years has been
>my little error trap. Although I have experienced some network
>disconnections of drives and printers on my windows computers, the error
>trap seems to work there too.


Well, yes, of course. Killing the redirection and creating a new one
should always work unless there is a serious problem in the network
that prevents setting up redirections at all.

>I know there is some network tweaking in the registry for windows, but just
>never seem to find the time to play around with it to find the best settings
>for my applications. I do agree with you that for a windows networking
>problem, finding the right registry settings would be preferable.


Then I would recommend a visit to Nick's networking page. Running his
..reg files just takes a second per computer (plus a reboot), and
several problems are fixed at the same time.

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com