FileSystemWatcher

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

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
 
Robert said:
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
 
Thanks...
The problem wih the Try/Catch is that I do not know where to put it. If
I have the application 'Break into the debugger' when a Common Language
Runtime Exception occurrs and click on BREAK I go into the Disassembler.
I cannot find the line of code that needs to inclosed in the Try/Catch.

Robert
(e-mail address removed)
 
Robert Hill said:
Thanks...
The problem wih the Try/Catch is that I do not know where to put it. If
I have the application 'Break into the debugger' when a Common Language
Runtime Exception occurrs and click on BREAK I go into the Disassembler.
I cannot find the line of code that needs to inclosed in the Try/Catch.

Robert
(e-mail address removed)

Make sure you are creating Debug files, and the solution is in Debug
mode....

Sueffel
 
I am in the 'debug' mode. The line of code where the app stops is here
in the Diassembly:

00000204 mov eax,ebp

I do not know how to wrap a Try/Catch around this.

Robert
(e-mail address removed)
 
Robert Hill said:
I am in the 'debug' mode. The line of code where the app stops is here
in the Diassembly:

00000204 mov eax,ebp

I do not know how to wrap a Try/Catch around this.

Robert
(e-mail address removed)

Check to make sure your PDB files are being generated, then you will have
your debug mode back. In the solution file, make sure the output is set to
build, then put a watch on the form_load even and see if the breakpoint
get's hit.

Sueffel
 
Back
Top