Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
Questionusing a namespace Pin
Member 20251764-Jan-07 21:40
Member 20251764-Jan-07 21:40 
AnswerRe: using a namespace Pin
Russell Jones4-Jan-07 21:48
Russell Jones4-Jan-07 21:48 
QuestionData validation in c# and SQL server 2000 Pin
phokojoe4-Jan-07 21:31
phokojoe4-Jan-07 21:31 
AnswerRe: Data validation in c# and SQL server 2000 Pin
Russell Jones4-Jan-07 22:13
Russell Jones4-Jan-07 22:13 
GeneralRe: Data validation in c# and SQL server 2000 Pin
phokojoe4-Jan-07 23:08
phokojoe4-Jan-07 23:08 
GeneralRe: Data validation in c# and SQL server 2000 Pin
Russell Jones5-Jan-07 0:31
Russell Jones5-Jan-07 0:31 
GeneralRe: Data validation in c# and SQL server 2000 Pin
phokojoe5-Jan-07 1:33
phokojoe5-Jan-07 1:33 
QuestionLimitation of FSWatcher & Windows Service Pin
Fayyaz Lodhi4-Jan-07 21:23
Fayyaz Lodhi4-Jan-07 21:23 
hi everyone!

I have a problem relating to Windows Services and FileSystemWatcherClass of .NET using c#.

I developed a windows service to monitor a specific folder on a server for changes and maintains its updated back up in another folder.

FileSystemWatcherClass is inherited to monitor and create mirror of a folder. It is available at http://www.codeproject.com/cs/files/directorymirror.asp?msg=1801877.

However, I found a limitation of this application. When copying large data (10 – 15 MB) it misses many events and only copies about half of the data. (This problem is also referred in the comments of the above article).

Possible cause of the problem:
When you copy or drop large amounts of data somewhere it can take several seconds for the system to write the data to the disk. The system cannot send feedback about the status of the operation (completed, failed, queued, etc) while it is performing it or while it is queued, and during this time other requests to the file system are queued by the system. This is what I think is the source of the problem: The FileSystemWatcher has no patience and throws an exception if it doesn’t get an IMMEDIATE response from the file system. So any big operation that takes a bit of time will end up throwing an exception and often but not always, cause the operation to abort. This class seems to be completely ignorant of how the windows file system works.


I found a solution to that on msdn, that says increase the INTERNALBUFFERSIZE. The Windows operating system notifies your component of file changes in a buffer created by the FileSystemWatcher. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification.

This solution resolved the problem somehow. I increased buffer to 64KB (default is 8192 bytes). This successfully copied data up to 35MB without missing a single file and suffices to my needs.

The problem is, when I integrated this into a Windows Service, it all failed to copy even 3 – 4 MB of Data. I have searching a lot but haven’t found the right solution yet.

I would be grateful if somebody could help me out with that. Thanks a lot for your patience of reading a long mail.

regards,

Fayyaz Khan Lodhi
fayyaz.lodhi@confiz.com
Questionxml reading/editing/writing Pin
divakarjmc104-Jan-07 19:37
divakarjmc104-Jan-07 19:37 
AnswerRe: xml reading/editing/writing Pin
sajid.salim.khan4-Jan-07 20:11
sajid.salim.khan4-Jan-07 20:11 
AnswerRe: xml reading/editing/writing Pin
Mircea Puiu4-Jan-07 20:43
Mircea Puiu4-Jan-07 20:43 
QuestionHow to Make EXE Pin
sajid.salim.khan4-Jan-07 19:07
sajid.salim.khan4-Jan-07 19:07 
GeneralRe: How to Make EXE Pin
Tyler454-Jan-07 19:31
Tyler454-Jan-07 19:31 
GeneralBut Sir Pin
sajid.salim.khan4-Jan-07 20:17
sajid.salim.khan4-Jan-07 20:17 
AnswerRe: But Sir Pin
Tyler454-Jan-07 20:28
Tyler454-Jan-07 20:28 
GeneralRe: But Sir Pin
sajid.salim.khan4-Jan-07 20:38
sajid.salim.khan4-Jan-07 20:38 
AnswerRe: But Sir Pin
Tyler454-Jan-07 20:58
Tyler454-Jan-07 20:58 
GeneralRe: But Sir Pin
JacquesDP4-Jan-07 20:34
JacquesDP4-Jan-07 20:34 
AnswerRe: How to Make EXE Pin
Mircea Puiu4-Jan-07 21:05
Mircea Puiu4-Jan-07 21:05 
AnswerRe: How to Make EXE Pin
Christian Graus4-Jan-07 23:58
protectorChristian Graus4-Jan-07 23:58 
AnswerRe: How to Make EXE Pin
TrooperIronMan5-Jan-07 5:34
TrooperIronMan5-Jan-07 5:34 
AnswerRe: How to Make EXE Pin
Tyler455-Jan-07 12:14
Tyler455-Jan-07 12:14 
QuestionDateTime.CompareTo() runtime miss Pin
swjam4-Jan-07 18:17
swjam4-Jan-07 18:17 
AnswerRe: DateTime.CompareTo() runtime miss Pin
Christian Graus4-Jan-07 18:32
protectorChristian Graus4-Jan-07 18:32 
AnswerRe: DateTime.CompareTo() runtime miss Pin
Phillip M. Hoff4-Jan-07 18:41
Phillip M. Hoff4-Jan-07 18:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.