By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Odd error in transport connection.

P: n/a
After six months flawless operation, I'm suddenly getting this error:
"Unable to read data from the transport connection." The code* hasn't
changed, and from what I can see, neither have the IP address, network
card, security protocols, etc. The code works fine on other machines,
but the critical one -- the one it's supposed to work on -- fails. The
stack trace** doesn't seem to help me out, but I thought perhaps someone
here could shed some light on where the problem might be occurring.

Thanks for any pointers!

--Brent

-------------------------------------------------------------

*Code:
=================================
HttpWebResponse oResponse = null;
HttpWebRequest oRequest = null;
Stream data = null;
StreamReader reader = null;

try
{
// Get HTML data
int tmp = ServicePointManager.DefaultConnectionLimit;
oRequest = (HttpWebRequest)WebRequest.Create(strURL);
oRequest.KeepAlive = false;
oRequest.Timeout = 10000; // 10 seconds
oRequest.UserAgent = "Web Client";
oResponse = (HttpWebResponse)oRequest.GetResponse();
if (oResponse.StatusCode == HttpStatusCode.OK)
{
data = oResponse.GetResponseStream();

reader = new StreamReader(data);

//Read from start the finish, line by line.
while ((thisRow = reader.ReadLine()) != null)
{
//do a bunch of stuff
}
}//end HttpWebResponse status code test
else
{
strError = "Bad HttpWebRequest status.";
}
reader.Close();
data.Close();
oResponse.Close();
}
catch(WebException e)
{
emit(e.Message + " Status: " + e.Status);
}
catch (Exception ex)
{
emit(ex.Message + "\n" + ex.StackTrace);
//ERROR IS CAUGHT HERE!
}
finally
{
if (reader != null){reader.Close();}
if(data != null){data.Close();}
if(oResponse != null){oResponse.Close();}
}
GC.Collect();

===============================

**Error & Stack Trace
===============================
Unable to read data from the transport connection
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32
offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.Connection.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.InternalBeginRead(Int32 bytesToRead,
NestedSingleAsyncResult castedAsyncResult, Boolean fromCallback)
at System.Net.ConnectStream.BeginReadWithoutValidatio n(Byte[]
buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset,
Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32
size)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadLine()
at nsImport13F.ImportThirteenF.writeHoldingstoDB(Stri ng strURL)" at
16:50:49
===============================
Jun 1 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.