By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,899 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,899 IT Pros & Developers. It's quick & easy.

FileSystemWatcher

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"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
Nov 20 '05 #2

P: n/a
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
rh***@wfubmc.edu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3

P: n/a
"Robert Hill" <rh***@wfubmc.edu> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
rh***@wfubmc.edu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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

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
Nov 20 '05 #4

P: n/a
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
rh***@wfubmc.edu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

P: n/a

"Robert Hill" <rh***@wfubmc.edu> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
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
rh***@wfubmc.edu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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
---
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
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.