A system call that should never fail has failed.

    Date: 11/10/05 (C Sharp)    Keywords: html, web

    I'm writing a program that basically is supposed to go to a site that has a mailing list archive on it and download each message from the archive, month by month. I've got all the parsing stuff taken care of to where it's getting the correct links and downloading the correct messages, etc. I've also got it so that it'll download about 6 months of messages. After that, I get a socket exception with the message "A system call that should never fail has failed." Does anyone have any idea what could be causing this?

    More details
    I'm using the System.Net.WebClient class to get the content of the page. First I get the content of the index page and parse the relevant links out. Here's the index page, I'm grabbing the links that say "date."

    After that, it goes into each month's archive and downloads all of the messages and writes them to a text file(after stripping out the html, etc.)

    If I just do 5-7 months, they work just fine. After that, I get the following error with the following stacktrace:

    Unable to read data from the transport connection: A system call that should never fail has failed.   at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.IO.StreamReader.ReadBuffer()
       at System.IO.StreamReader.ReadToEnd()
       at MListGetter.Form1.getPage(String address) <==this method should download the message
       at MListGetter.Form1.getMsgText(String url)
       at MListGetter.Form1.processMonth(String dateline, String url)
       at MListGetter.Form1.button1_Click(Object sender, EventArgs e)
    


    Here is the text of the method where the exception is thrown:
    private string getPage(string address)
    {
    	System.Net.WebClient cl =  new System.Net.WebClient();
    
    	System.IO.Stream s = cl.OpenRead(address);
    	System.IO.StreamReader sr =  new System.IO.StreamReader(s);
    			
    	string res = sr.ReadToEnd();
    			
    	sr.Close();
    	s.Close();
    	cl.Dispose();
    			
    
    	return res.Replace("\n", "\r\n");
    }
    




    I would be eternally grateful to anyone who can shed some light on this.

    Source: http://community.livejournal.com/csharp/41360.html

« Drawing a line on a form. || some marshalling questions »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home