473,473 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FileSystemWatcher

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
5 3292

"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
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
"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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Josh Usovsky | last post by:
I'm setting up a watched folder using FileSystemWatcher. When I drop a small file into the watched folder, I can respond to a .Created event and process the file with other code. However, if I try...
1
by: Troy Murphy | last post by:
How do I prevent the FileSystemWatcher event to keep firing while the file is being created? When copying a file to the watched folder, the event fires a dozen or more times! Also, the...
7
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know...
2
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange,...
13
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just...
3
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
12
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
5
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't...
5
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.