Problem getting multiple web streams

  • Thread starter Ernest Jones via .NET 247
  • Start date
E

Ernest Jones via .NET 247

I'm streaming several files from a web server (using C#), and asI set up the streams, my code blocks(and then times out) whiletrying to start the 3rd request. Testing seems to indicate thatit has something to do with the size of the files requested (itdoesn't block if I'm requesting files less than about 4k insize). Here's some sample code to demonstrate the problem:

WebClient client = new WebClient();
Stream strm =client.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient aclient = new WebClient();
Stream astrm =aclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient bclient = new WebClient();
Stream bstrm =bclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");


A packet capture shows that the 3rd HTTP GET is never sent.

I also tried going under the covers and using HttpWebRequest andit does the same thing (blocks when getResponse() is called thethird time).
Anyone got any ideas?
 
J

John Saunders

I'm streaming several files from a web server (using C#), and as I set up
the streams, my code blocks(and then times out) while trying to start the
3rd request. Testing seems to indicate that it has something to do with the
size of the files requested (it doesn't block if I'm requesting files less
than about 4k in size). Here's some sample code to demonstrate the
problem:

WebClient client = new WebClient();
Stream strm = client.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient aclient = new WebClient();
Stream astrm = aclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient bclient = new WebClient();
Stream bstrm = bclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");


A packet capture shows that the 3rd HTTP GET is never sent.

I also tried going under the covers and using HttpWebRequest and it does the
same thing (blocks when getResponse() is called the third time).
Anyone got any ideas?
 
J

John Saunders

I'm streaming several files from a web server (using C#), and as I set up
the streams, my code blocks(and then times out) while trying to start the
3rd request. Testing seems to indicate that it has something to do with the
size of the files requested (it doesn't block if I'm requesting files less
than about 4k in size). Here's some sample code to demonstrate the
problem:

WebClient client = new WebClient();
Stream strm = client.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient aclient = new WebClient();
Stream astrm = aclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
WebClient bclient = new WebClient();
Stream bstrm = bclient.OpenRead("http://10.0.0.6/greyscale_0_2.jpc");
---------------

Why do you need all three streams open at the same time? Finish with one
before proceeding to the next.

There's typically a limit of two open connections at a time. That would be
why the third one blocks.
 
Top