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 / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Stream.BeginRead pointless?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Damien - 19 Jul 2007 09:55 GMT
Are the Begin/End Read/Write operations on Stream pointless?

The reason I ask is that the default implementation in Stream in fact
does a synchronous read within the BeginRead operation, and the
documentation indicates that this behaviour "may" be overridden by
specific subclasses of Stream.

So, if I'm writing a generic class that accepts two stream objects,
and wants to ensure that it's getting the best throughput from both
streams, I have to assume that one or both of those streams may in
fact be hiding a synchronous Read - which means further that to get
the most from both streams, I need to spawn a thread for each one -
and once I've done that, I may as well just call Read.

There doesn't seem to be any way to determine whether or not a
particular stream does *in fact* implement these operations
asynchronously. Is my reasoning correct?

Damien
Henning Krause [MVP - Exchange] - 19 Jul 2007 10:36 GMT
Hello,

the default BeginRead creates a new thread by itself, thereby simulating an
asynchronous read. But the FileStream uses more efficient async
techniques....

Kind regards,
Henning Krause

> Are the Begin/End Read/Write operations on Stream pointless?
>
[quoted text clipped - 15 lines]
>
> Damien

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.