Using Sockets.NetworkStream.Read very slow on Win2K3

S

Skeeve

Hi,

I am doing the following:

While i <> 0
i = NWStream.Read(bytesToRead, n, 1)'bytesToRead is a ByteArray
n += 1
End While

For an incoming stream of 17K, this takes anywhere from 5 to 30
seconds (different every time I try even though the same stream is
received).

It only seems to happen on Win2K3.

The strange thing is that the same code is used for other transactions
where the size is about 5K and the performance is just fine.

The stream received is an XML document which shouldn't be important in
this case as it is the "Byte per Byte" reading of the stream that's
slow.

Any idea how I could increase the speed here?

Thank you,
Torsten
 
F

Feroze [msft]

Why are you doing a byte-by-byte read of the response ? Why not allocate a
for eg, 4k buffer, and use that for reading ?

Anyway, the delay is hard to explain without looking at the network sniff.
Can you look at a network sniff and see if the server is sending the data
slowly ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top