3 messages in com.googlegroups.adwords-apiRe: Timeout for downloading custom re...
FromSent OnAttachments
JC22 Nov 2007 02:08 
nilnur23 Nov 2007 00:23 
JC27 Nov 2007 00:05 
Subject:Re: Timeout for downloading custom reports (20 minutes)?
From:nilnur (b.ni@gmail.com)
Date:11/23/2007 12:23:23 AM
List:com.googlegroups.adwords-api

Hi JC

I received timeout error messege, too. And I asked it here. There are lots of questions here about timeout error messege. I think this is a Microsoft bug, I am not sure. But I solved this problem to add the code below in my project. Add this code in the Reference.vb file of the web reference you added your project. I hope this code helps you.

Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest Dim webRequest As HttpWebRequest = CType(MyBase.GetWebRequest(uri), HttpWebRequest) webRequest.KeepAlive = False Return webRequest End Function

Protected Shadows Function Invoke(ByVal methodName As String, ByVal parameters As Object()) As Object() Const MAX_CONNECTION_ATTEMPTS As Integer = 6

Dim connectionAttempts As Integer = 0 Dim connectionSucceeded As Boolean = False Dim invokeReturn As Object() = Nothing

While ((connectionAttempts <= MAX_CONNECTION_ATTEMPTS) AndAlso (Not connectionSucceeded)) Try connectionAttempts += 1 invokeReturn = MyBase.Invoke(methodName, parameters) connectionSucceeded = True Catch ex As WebException 'Put the thread to sleep for 10 seconds and try again. 'This might help to get around some of the various 'connection issues experienced such as '502 Bad Gateways' System.Threading.Thread.Sleep(10000) If (connectionAttempts = MAX_CONNECTION_ATTEMPTS) Then Throw ex End Try End While Return invokeReturn End Function

On 22 Kasım, 12:08, JC <jon.@happybunnysoftware.co.uk> wrote:

Hi,

We are running a custom report to download stats for a large number of keywords in a number of campaigns (for several clients) for the last 30 days.

The report generates fine (but takes over 15 minutes), we then process the report by streaming the GZIP version of the report. This works fine if the report takes less than 20 minutes to process, but if it takes longer we get the error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host".

Does google impose a 20 minute limit on the files? Would we be better downloading the file in full an processing it locally?

The system is written in VB.Net using Visual Studio 2005. It uses the Microsoft generated wrapper code for the web service. We are currently using V10 of the APIs.

The error we are getting is:

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 ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.Fill() at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(By-te[] buffer, Int32 offset, Int32 count) at ICSharpCode.SharpZipLib.GZip.GZipInputStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Xml.XmlTextReaderImpl.ReadData() at System.Xml.XmlTextReaderImpl.EatWhitespaces(BufferBuilder sb) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent()