Using IdHTTP I get Error 10054 Connection Reset by Peer

Hi,

I'm trying to get a GIF image from a website every 15 minutes.  But it only works the first time.  At the next attempt (after 15 minutes) I get the error message.  Here is the code :

procedure TForm.Timer1Timer(Sender: TObject);
begin
  GetRadarImage;
end;

procedure TForm.GetRadarImage;
var
  MS : TMemoryStream;
  GIf: TGIFImage;
begin
  MS := TMemoryStream.Create;
  GIf := TGIFImage.Create;
  try
    IdHTTP1.get(RadarURL,MS);
    Ms.Seek(0,soFromBeginning);
    Gif.LoadFromStream(MS);
    Gif.SaveToFile(ExtractFilePath(ParamStr(0))+'radar.tmp');
  finally
    FreeAndNil(GIF);
    FreeAndNil(MS);
  end;
end;

I'm doing something similar on another website to get XML data, and there it works fine.  The only difference between the two http calls is the overloaded method.  In this case I'm using the procedure

procedure Get(AURL: string,AResponseContent: TIdStream); overload;  // this one gives the eror

while in the other case I'm using

function Get(AURL: string): string; overload;  // this one works fine

Should I reset something before calling GET again ?

Thanks,

Soitjes.
0
S
11/24/2010 7:45:04 PM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

2 Replies
5856 Views

Similar Articles

[PageSpeed] 42

<S oitjes> wrote in message news:308352@forums.embarcadero.com...

> I'm trying to get a GIF image from a website every 15 minutes.
> But it only works the first time.  At the next attempt (after 15
> minutes) I get the error message.

What do you have the ProtocolVersion property set to?  If pv1_1, then try 
setting it to pv1_0, or alternatively setting the Request.Connection 
connection to 'close' instead.  Either way will tell the server to close the 
connection after sending its response.  For HTTP 1.1 requests, the default 
is 'keep-alive', which will keep the socket open after the response is sent. 
The server is then likely closing the socket on its end after an idle 
timeout, and then TIdHTTP is detecting that on the next request attempt and 
failing to re-connect correctly.

Alternatively, try calling Disconnect() after Get() exits.

Alternatively, destroy the TIdHTTP object and create it each time your timer 
elapses.

> I'm doing something similar on another website to get XML data, and
> there it works fine.  The only difference between the two http calls is
> the overloaded method.  In this case I'm using the procedure
>
> procedure Get(AURL: string,AResponseContent: TIdStream); overload;  // 
> this one gives the eror
>
> while in the other case I'm using
>
> function Get(AURL: string): string; overload;  // this one works fine

All of the Get() (and Post()) overloads go through the same internal method 
for the actual work - DoRequest().  The only difference between the 
overloads is how input and output data is prepared and processed 
before/after TIdHTTP sends a request to the server.

BTW, which version of Indy are you using?  TIdStream has not existed for a 
long time, which makes me think you are using an outdated version and should 
upgrade.

-- 
Remy Lebeau (TeamB)
0
Remy
11/24/2010 8:38:56 PM
Remy,

I tried ProtocolVersion set  to pv1_0, but that didn't make a difference.

Then I tried disconnect right after the get, and that worked.  The error message no longer appears at the next get after 15 minutes.

Thanks very much for you support,

Soitjes.


> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> <S oitjes> wrote in message news:308352@forums.embarcadero.com...
> 
> > I'm trying to get a GIF image from a website every 15 minutes.
> > But it only works the first time.  At the next attempt (after 15
> > minutes) I get the error message.
> 
> What do you have the ProtocolVersion property set to?  If pv1_1, then try 
> setting it to pv1_0, or alternatively setting the Request.Connection 
> connection to 'close' instead.  Either way will tell the server to close the 
> connection after sending its response.  For HTTP 1.1 requests, the default 
> is 'keep-alive', which will keep the socket open after the response is sent. 
> The server is then likely closing the socket on its end after an idle 
> timeout, and then TIdHTTP is detecting that on the next request attempt and 
> failing to re-connect correctly.
> 
> Alternatively, try calling Disconnect() after Get() exits.
> 
> Alternatively, destroy the TIdHTTP object and create it each time your timer 
> elapses.
> 
> > I'm doing something similar on another website to get XML data, and
> > there it works fine.  The only difference between the two http calls is
> > the overloaded method.  In this case I'm using the procedure
> >
> > procedure Get(AURL: string,AResponseContent: TIdStream); overload;  // 
> > this one gives the eror
> >
> > while in the other case I'm using
> >
> > function Get(AURL: string): string; overload;  // this one works fine
> 
> All of the Get() (and Post()) overloads go through the same internal method 
> for the actual work - DoRequest().  The only difference between the 
> overloads is how input and output data is prepared and processed 
> before/after TIdHTTP sends a request to the server.
> 
> BTW, which version of Indy are you using?  TIdStream has not existed for a 
> long time, which makes me think you are using an outdated version and should 
> upgrade.
> 
> -- 
> Remy Lebeau (TeamB)
0
S
11/25/2010 8:13:45 PM
Reply:

Similar Artilces:

Delphi XE HTTP: error "Socket Error #10054 Connection reset by peer" [Edit]
Communication type is set to HTTP, LifeCycle is set to Invocation. Invocation represents a stateless connection, but when the network connection drops, the client throws the error "Socket Error #10054 Connection reset by peer". Are there any other properties to set up apart from LifeCycle? Hi Irina, > Communication type is set to HTTP, LifeCycle is set to Invocation. > > Invocation represents a stateless connection, but when the network connection drops, the client throws the error "Socket Error #10054 Connection reset by peer". Are there any other proper...

"Socket Error # 10054 Connection reset by peer" error in TidHTTPServer
I have been playing around with TidHTTPServer from Indy 10.5.8.0 (supplied with RAD XE2). I am not using any IO handlers, nor am I assigning a stream to Response.ContentStream. I am just returning some text back in Response.ContentText. I am Using IE 8.0 as my web browser, everything works fine until I close the browser, then I get the exception EIdSocketError "Socket Error#10054 Connection Reset By Peer." If I click on continue, the program continues to execute. The curious thing though, the exception only throws when I close the Browser with my server...

Connection reset by peer error 10054
Hello, Using Delphi XE3 I developed a Datasnap webbroker ISAPI (IIS 7.5) application which works fine as you works with it... To be more clear If I leave the app inactive and try to use it after 3/4 minutes I receive a "socket error #10054 connection reset by peer" error I'm using a session live cycle on the server and I didn't changed any session default timeout (which should be 20mins.). Is there any kind of inactivity timeout I have to set up for a longer period ? Is there a way to intercept this error to try reconnecting to the server ? Thanks, Davide Hi, ...

Socket Error #10054. Connection reset by peer.
Hello I use Intraweb Ultimate 12.2.8 with Delphi XE2 Update 4. Not always but mostly I get an Exception EIdSocket Error when I show a new IWForm (or going back to the existing). Text: Socket Error #10054. Connection reset by peer. I'm not sure where to look. I write a database application with Oracle and Odac components from DevArts and I use also TMS Intraweb components. Any Idea how I can find out ? Thank you Christian > {quote:title=Christian Bugge wrote:}{quote} > Hello > I use Intraweb Ultimate 12.2.8 with Delphi XE2 Update 4. > > Not always b...

help. when using Profile GetPropertyValue, I get the following connection error: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure
 Hi,I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property((string)(this.GetPropertyValue("Address1")));When I look at the stack, it is coming from my ProfileWrapper class which adds user address, city, etc.. from a class which inherits fromSystem.Web.Profile.ProfileBase. From the stack, it is calling the System.Web.Profile and crashed when it tries to open a connection atSystem.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObj...

Handling Indy10 exceptions
Hi there everyone, I am using Indy10 TCP Server/Client and I'm thinking of a way to handle an exception of type socket error #10054 - connection reset by peer. This sort of error can happen accidentally for example if the client computer experiences a sudden power failure or the client program is "killed" in the Task Manager. Server side, I have a listview that shows all connected clients. So whenever a socket error #10054 happens, the server MUST remove the client from the listview and return the client's database connection to a connection pool. That is what I've ...

Trying to use SMTP and get Connection aborted by peer: connect
I am having trouble getting Javamail to send mail through our SMTP server. The code works like a charm when I do it from my local development machine (W2K and which has a Notes client on it if that matters), but when I try to execute the exact same code on our server (W2K3). Both are running EAS 5. Any ideas? Does something need to be enabled on the server? I can telnet to the smtp server port 25 successfully, so I question if it's a firewall issue. Google on this error tells me it's basically a java catchall.... Any help would be appreciated -- thanks! D Ja...

#10054 Connection reset by peer
Hi, I upgraded from Indy 10 r3830 to r4103. Now I (very) often get this #10054 exception after I disconnect. The same application using r3830 doesn't have this problem. In the status event of IdFtp: Disconnecting then Disconnected but then this exception (#100054). I found some changes in IdFtp "DisconnectNotifyPeer": - r4103: procedure TIdFTP.DisconnectNotifyPeer; begin if IOHandler.Connected then begin IOHandler.WriteLn('QUIT'); {do not localize} IOHandler.CheckForDataOnSource(100); if not IOHandler.InputBufferIsEmpty then begin ...

I/O Error Connection reset by peer
Hi everyone, I use Net::LDAP in a script that does a daily search on a large LDAP database (~80,000 entries). The expected return from the search is ~2000 entries. One run of the script threw up this error: my $mesg = $ldap->search(base=>...); $mesg->error was "I/O Error Connection reset by peer" I dont think this has anything to do with an ldap search size limit. For one thing, I expect to get a "sizelimit exceeded" error in that case and I have error-handling for that and the other thing is that I dont expect to exceed the size limit. I use...

Firemonkey Datasnap client connection reset by peer or socket error
I am using RAD Studio XE5 and C++ Builder. I have a Firemonkey application that is running on a poor network. It looses connection with the server at random, and I need to detect when that is happening. I would like to be able to trap the errors for Socket errors and the try to reconnect if I can. The issue is that there was a TApplicationEvents for VCL that could do that. I see nothing like that for Firmonkey. How can I trap or detect a disconnect for the client application in Firmonkey. Thanks, ...

Get "connection was reset" error on FT.com
Name: David Rademeyer Email: daviddotrademeyeratdukedotedu Product: Gran Paradiso Summary: Get "connection was reset" error on FT.com Comments: Every time I try to read stories on FT.com, I get a "The connection was reset" error page. This does not happen on any other website, or even on the front page(s). I started getting this error in Firefox 2, which is why I tried out Gran Paradiso, but now it's started again. Clearing cache, etc, or restarting Firefox do not fix the problem. Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-...

Datasnap "connection reset by peer" error on iOS?
Hi, i use 3 tier application on iOS. iOS client, windows server and SQL server. i use datasnap tcp/ip for client-server connection. Everything good but after program goes to background, connection broken and iOS application gives "connection reset by peer" error. How could i solve this? - is there a way detect application goes to background? - is there a way detect connection broken and reconnect without gives an error? Thanks. ...

Connection Reset By Peer Error With Jaguar 4.2 Web Server
We have recently upgraded from Jaguar 4.1 to Jaguar 4.2. Our current runtime environment is Windows 2000, Jaguar 4.2 build 42012 and JDK 1.4.1_01. We use the Jaguar web server as well as the Jaguar application server. The browser that our users use is Netscape. Since the upgrade to Jaguar 4.2, we experience an intermittent problem in the web server. When a JSP is to be displayed to the user, occasionally the user gets a Netscape pop-up window stating "A network error occurred while Netscape was receiving data. (Network Error: Connection reset by peer). Try connecting again." We never received this error with Jaguar 4.1 web server. It doesn't seem to cause a major problem as the user can just click OK in the dialog box and go on their way. But it is definitely something that should not be happening and that has only started since going to Jaguar 4.2. Does anybody have any ideas or thoughts on what in Jaguar 4.2 might cause this problem and, better yet, any thoughts on a solution? Thanks. Steve ...

Re: 500-Connection reset by peer errors (version 5.47)
I've found that using a proxy for http and https requests eliminates this problem. This is a good workaround for me, but it might suggest that there's something LWP is missing in the way of handling socket connections that other software (Apache, Lynx, Netscape...) does. One other (somewhat unrelated) thing I found that might help someone else out is that other browsers change the method of a redirected POST to GET. This was causing me problems where I couldn't get past the login on a secure site - I kept getting redirected in a circle back to the login page. Here&...

Getting pthread_mutexattr_init error using direct connect 11.7 for informix
I get the following error while trying to connect to informix using the direct connect for informix 11.7 service. /usr/lib/dld.sl: Unresolved symbol: pthread_mutexattr_init (code) from /appl/informix/7.31.UC5/lib/esql/libtos.sl LogNotice 03/26/2003 16:02:22.580454 <<service name>> 5 <<USER>> ctisql Could not communicate with access module. Connection timeout. Signal [13] received and ignored. LogClientMessages 03/26/2003 16:02:22.597583 <Direct Connect Servername> NULL NULL NULL Error: 30000 Severity: 16 ...

Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application
 Why we use Web.Config File for connection string wether we can use class Library for get connection for whole web Application  please help me? Friend, Web.config has its own advantages. 1) Web.Config is used to store the important information like connections strings etc...so that it can be modified even after the code has been    deployed to the server without compiling the entire application again. 2) Since it is a XML file, there is no need of building the project of you are going to change the connection strings.   If you go for the class files,...

Powersite generated asp using ODBC connection to MSSQL gets error on update
I created a pretty straightforward web page with a HTML DTC on it to do a customer survey. It has non updateable information fields at top and then 5 updateable fields at bottom for rating different areas. All fields are columns from a row in a MS SQL database table. From within the Datawindow Builder I can retrieve and update ok (on my pc). When I deploy to my NT Server running IIS I can retrieve ok but when I click the Submit button to update the row I get "ERROR: Action Failed = -1 ***************************". The ODBC DSN on the server is eactly like the one on my pc. ...

Can't connect to restore path as use, get D101 Error
NetWare 6.5 SP6 GroupWise 7.0.2 I can login as myself and connect to the restore area I cannot login as a recovered user that was deleted yesterday to the restore area, I get a D101 User not found error. The restore area is on a different volume on the same server. We run a nightly job to backup the active Domain and PO from one volume to another using the following commands: dbcopy /i 11-1-07 /m /b grpwise:primdom gback:primdom dbcopy /i 11-1-07 /m /b grpwise:primpo gback:primpo The Restore area management in Console one is set to \GWgbackprimpo Membership is set to t...

Getting error message using error number
This probably is a silly question - Can anybody tell me how to trap an error message that is returned from the database inside a stored procedure? I am able to trap the error using the global var @@error, but dont seem to find any such thing for the text of the error message. I also am able to get the text of the corresponding error number from master..sysmessages, but then, the placeholders are empty. Any help is appreciated Thanks Arviind Rajan wrote: > > This probably is a silly question - > Can anybody tell me how to trap an error message that is returned from ...

Getting "When connecting to SQL Server 2005 Error" using MS SQL 2000?
I'm new to using VS2005 and this is my first project connecting to our MS SQL 2000. App worked fine on my dev PC, connection to the same MS SQL Server. Published the web site to the web server (same server running MS SQL Server) and getting the below error. Is this a permission setup problem on SQL Server or does it really think it's connecting with a MS SQL 2005 database? An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remot...

Delphi 2009
Hello, I am using Delphi 2009 with a recent Indy 10.5.5 development snapshot. In my code I am using a TIDHttp with TIDSSLIOHandlerSocketOpenSSL. The Open SLL .dlls I am using is from the the indy website and are openssl-0.9.8k-i386-win32. The issue is, randomly, I am getting a socket error # 0 error. I never got this error with Delphi 2007 and Indy 10.2.3. Any help would be GREATLY appreciated! Thank you. The code looks something like this: var sHttpResult, sVar, sParam: string; ssHttpResult : TStringStream; slPostData : TStringList; begin IdSSL.CheckForDi...

I'm getting java.sql.SQLException and Database not found error while connecting SQL Anyware using ODBC driver.
Hi Friends, I'm getting java.sql.SQLException and Database not found error while connecting SQL Anyware using ODBC driver. I've specified following points while creating the DSN DSN name=xyz Server name=abc User name=pqr password=**** And I'm trying to access this database by writing a JAVA program. I created URL like this jdbc:odbc:xyz Now it is throwing above error can anyone please suggest me how to get rid of this problem, any thing more has to be done, please specify Thanks in advance, hamsa ...

[connect error] Interbase Connect Error
In ODBC connect test is successfully.. but in PowerBuilder 6.5 Database Profiles is displayed error message.. Error Message is SQLSTATE = 40001 [Easysoft][Interbase]Dynamic SQL Error, SQL error code = -91, feature is not supported What means this message? Now I use PowerBuilder 6.5 & Interbase 5.6... Just I choose - Profile Name - Data Source --> This is ODBC DNS..(user DNS) - User ID - Password Does it need more? ...

RE: Error while reading socket: Connection reset by peer at /usr/local/lib/perl5/site_perl/5.6.1/RPC/PlServer/Comm.pm line 110.
Hmmmm. Is the resolved in 5.8 ? Perl 5.6.1 on Win32 leaks socket handles - maybe that's the reason. Windows Server - $VERSION =3D '1.012'; Unix Machine - $VERSION =3D '2.08'; -----Original Message----- From: Steffen Goeldner [mailto:sgoeldner@cpan.org] Sent: Tuesday, August 17, 2004 8:58 AM To: Jochen Wiedmann Cc: dbi-users@perl.org; Woodrow, Michael A, ALABS; Sackner, Beth A, ALABS; Morello, Anthony, ALABS; Long, Dan, ALABS; Esser, Marc A, ALABS Subject: Re: Error while reading socket: Connection reset by peer at /usr/local/lib/perl5/site_perl/5.6.1...