Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / September 2005

Tip: Looking for answers? Try searching our database.

System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a streamwriter writing to a network share, is it possible for the netw

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 06 Sep 2005 20:54 GMT
System.IO.StreamWriter Close or Flush method to shut down the computer in
such a way that just part of the file is written? or an empty file is
written? Also if the Close or Flush is to a streamwriter writing to a
network share, is it possible for the network to go down in such a way that
the tartet file is only partialy written? or are there some kind of check
sums to prevent this.
Helge Jensen - 07 Sep 2005 09:02 GMT
> System.IO.StreamWriter Close or Flush method to shut down the computer in
> such a way that just part of the file is written? or an empty file is
> written? Also if the Close or Flush is to a streamwriter writing to a
> network share, is it possible for the network to go down in such a way that
> the tartet file is only partialy written? or are there some kind of check
> sums to prevent this.

I'm not really sure what you are asking here. I am going to guess that
you are asking:

  Can I be sure that all data written to StreamWriter is written to the
underlying Stream?

If Flush or Close completes without exceptions, all data should be sent
to the underlying stream. Any guarantee beyound that are given by the
stream.

(The following statements assume you are using synchronueous Streams and
operations on them)

If you are writing to a FileStream, the underlying file should be fully
written, not partially, but there is no assurance from FileStream, that
the computer cannot be reset or whatever and the file is left only
partially updated on disk. Such a guarantee comes from the file-system
itself.

If you are writing to a TCP-based NetworkStream, then you will know that
the receiving side acknowledged your entire stream content, but it may
*not* update it's state, since it may be reset before processing the
package.

If you are writing to an UDP-based NetworkStream, you will not know
anything but that all packages have left your process and these may, or
may not reach their destination.

Signature

Helge Jensen
  mailto:helge.jensen@slog.dk
  sip:helge.jensen@slog.dk
               -=> Sebastian cover-music: http://ungdomshus.nu <=-


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.