几个连接到远程互联网网站

时间:2011-08-06 23:37:34

标签: .net http httpwebrequest

作为实验的一部分,我正在尝试将32个并发连接连接到互联网上的网站并下载与该连接的每个网址相关联的html页面,但我在大约10到20个中获得以下异常连接

 System.IO.IOException: Unable to read data from the transport connection: 
    An existing    connection was forcibly closed by the remote host. --->
    System.Net.Sockets.SocketException: An existing connection was forcibly 
    closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, 
    Int32 offset, Int32 size, SocketFlags socketFlags)
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.StreamReader.ReadBuffer()
   at System.IO.StreamReader.ReadToEnd()

1 个答案:

答案 0 :(得分:2)

  1. 服务器可以限制您使用X连接
  2. 因为你只能拥有真正的并发性,直到你的cpu中的核心数量,之后它是随机的,首先执行什么连接
  3. 可以是您列出的任何步骤
  4. 服务器希望尽可能多的唯一人(IP地址)访问
  5. 不同的IP地址,需要另一个物理连接或通过代理服务器连接一些连接,如果两者都不可能你无法绕过它