Using VS2005, VB.NET,
I have a multi-threaded application. In one of my threads I need to
read a file as a binary stream. I am able to accomplish this using the
following code:
1 Dim BinaryFile As FileStream = New FileStream(<som e file name>,
FileMode.Open, FileAccess.Read , FileShare.Read)
2 Dim BinRead As BinaryReader = Nothing
3 Me.BinRead = New BinaryReader(Bi naryFile)
4 Me.BinRead.Base Stream.Seek(0, SeekOrigin.Begi n)
5 Me.BinBytes = Me.BinRead.Read Bytes(<number of bytes to read>)
The code above works for me save one issue: on the first execution,
line 1 takes a really long time (4-7 seconds) to execute and don't
have any idea why.
Anyone have an idea what could be causing this latency and how to
avoid it?
Thanks for your attention to this...
I have a multi-threaded application. In one of my threads I need to
read a file as a binary stream. I am able to accomplish this using the
following code:
1 Dim BinaryFile As FileStream = New FileStream(<som e file name>,
FileMode.Open, FileAccess.Read , FileShare.Read)
2 Dim BinRead As BinaryReader = Nothing
3 Me.BinRead = New BinaryReader(Bi naryFile)
4 Me.BinRead.Base Stream.Seek(0, SeekOrigin.Begi n)
5 Me.BinBytes = Me.BinRead.Read Bytes(<number of bytes to read>)
The code above works for me save one issue: on the first execution,
line 1 takes a really long time (4-7 seconds) to execute and don't
have any idea why.
Anyone have an idea what could be causing this latency and how to
avoid it?
Thanks for your attention to this...
Comment