
How can I check the availability of a network share through Visual Basic code
Hi Philippe,
I've seen more questions like this one before and the most given answer was
to either ping or connect to the server. Pinging a server requires some code
and isn't really nessesary. Servers are most of the time running some
additional services like e-mail serving, a proxy or whatever. By using the
Winsock controls you can try to make a connection to the server at one of
the ports at which a service should be running. Within a few seconds it will
return an error if it can't connect (and the server is down) or it connects
(the server is available). There's only a possible negative side-effect of
this. If your computer is configured for dialup networking and you have it
set to dial whenever a connection is needed, it will make a connection if
the server isn't available. But you can turn this feature off, so I think
this is a good way to accomplish what you want.
Good Luck!
Kind Regards,
Koen
** Holland, Europe **
Quote:
> Dear API Specialist(s),
> I am writing a Sales Force program in Visual Basic which uses data stored
on
> an Access database. The master database is located on a network server
and
> a replica is located on each (portable) client computer.
> When starting the program I would like to check (as fast as possible) if
the
> master database on the network can be reached to decide if the program
> should run on the master database or on the local copy.
> Calling the standard Dir-function in VB only returns the not-found error
> after 10 to 20 seconds. This is too long!
> Does anyone know a faster solution to my problem?!
> Best regards,
> Philippe