"Robert" <rh***@wfubmc.edu> wrote in message
news:07****************************@phx.gbl...
I am using VB.NET and the FileSystemWatcher monitoring a
network drive. Periodically I will get an error such as
this:
A first chance exception of
type 'System.Net.Sockets.SocketException' occurred in
system.dll
Additional information: An existing connection was
forcibly closed by the remote host
How can I trap this error and re-establish a connection
in order to continue monitoring the directory on the
network? The application I have written must run
continuously, 24..7.
Thanks,
Robert
It sounds liek the server is reading a TimeOut of the connection and closing
it. You could capture the error in a Try/Catch loop, then just stop and
restart the filesystem watcher. I had a similar problem, and every 5
minutes, I have my service write a small textfile to the network frive, then
delete it bout a minute later. Sloppy in my opinion, but things have been
beinghave.
HTH
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004