"Connection closed gracefully" errors

I am using the TIdHTTP component from Indy 10.5.1 with Delphi 2007. 
Occasionally my app will be working away and I will get a "Connection 
closed gracefully" exception during the Post method for no apparent 
reason.  That is, there are no other errors reported.  Once, this error 
is reported, all subsequent attempts to Post will return the same error. 
   The only way to get the application running again is to shut it down 
and restart it.  BTW, I always call the Close method after each Post,
successful or not.

How can I recover from this error condition?
0
Stephen
8/26/2009 6:02:21 PM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

3 Replies
3010 Views

Similar Articles

[PageSpeed] 40

"Stephen Boyd" <steve.boyd@amtelecom.net> wrote in message 
news:154560@forums.codegear.com...

> I am using the TIdHTTP component from Indy 10.5.1 with Delphi 2007.

The current version of Indy 10 is 10.5.6.  Please upgrade and see if the 
problem continues.

> Occasionally my app will be working away and I will get a "Connection
> closed gracefully" exception during the Post method for no apparent
> reason.

It means the server actively closed the connection on its end while your end 
was stilling read/writing data.

> Once, this error is reported, all subsequent attempts to Post will return 
> the same error.

You need to disconnect on your end first.

-- 
Remy Lebeau (TeamB)
0
Remy
8/26/2009 9:59:38 PM
Remy Lebeau (TeamB) wrote:
> 
> The current version of Indy 10 is 10.5.6.  Please upgrade and see if the 
> problem continues.
> 

OK

>> Occasionally my app will be working away and I will get a "Connection
>> closed gracefully" exception during the Post method for no apparent
>> reason.
> 
> It means the server actively closed the connection on its end while your end 
> was stilling read/writing data.
> 

I sort of knew this.

>> Once, this error is reported, all subsequent attempts to Post will return 
>> the same error.
> 
> You need to disconnect on your end first.
> 

What do you mean by 'disconnect'?  I already call 
TIdHttp.IOHandler.Close.  Is there something else that I need to be 
doing to disconnect?

Here is the code that I use to do the post.

function Post(const app: String; const params: String): String;
var
     url         : String;
     strm        : TMemoryStream;
begin
     url := Format('%s/%s', [FUrl, app]);
     strm := TMemoryStream.Create;
     try
         strm.Write(PChar(params)^, Length(params));
         HTTP.IOHandler.ReadTimeout := FTimeout;
         HTTP.IOHandler.ConnectTimeout := FTimeout;
         if (FTraceOn) then
             WriteTrace('>> %s', [params]);
         try
             Result := HTTP.Post(url, strm);
         finally
             HTTP.IOHandler.Close;  // Force socket closed to avoid 
10054 errors
         end;
         if (FTraceOn) then
             WriteTrace('<< %s', [Result]);
     finally
         strm.Free;
     end;
end;
0
Stephen
8/27/2009 1:38:41 PM
"Stephen Boyd" <steve.boyd@amtelecom.net> wrote in message 
news:155033@forums.codegear.com...

> What do you mean by 'disconnect'?  I already call
> TIdHttp.IOHandler.Close.  Is there something else
> that I need to be doing to disconnect?

Use TIdHTTP inherits a Disconnect() method from TIdTCPConnection.  Use that 
instead.  Do not call TIdIOHandler.Close() directly.

-- 
Remy Lebeau (TeamB)
0
Remy
8/27/2009 5:31:28 PM
Reply:

Similar Artilces:

"submit" to Access DB returns "connection closed"error
The error when I submit data  is as follows: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.Source Error: Line 17: Dim comDatabase As New System.Data.OleDb.OleDbCommand(strSQL, conDatabase) Line 18: Line 19: comDatabase.ExecuteNonQuery() Line 20:...

"Connection closed gracefully" on computers where Delphi is not installed
Hello dear programmers, I am experiencing a problem with an email client application I made using indy TIdSMTP: I didn't experience problems on development computers, where there's Delphi installed. On other computers, while sending mail I get this exception: "Connection closed gracefully" and email is not sent. Maybe I should include some package? Thanks in advance. <Flavio Foglia> wrote in message news:297116@forums.embarcadero.com... > I am experiencing a problem with an email client application I made using > indy TIdSMTP: Which versions of...

"Error Group: WINSOCK" "Error Code:11004"
Hi Just setup iPrint on the server and tried to install the printer to the laptop and got the following message: Error code:11004 Error message: Winsock 11004 - The DNS name has been found in the database, but its associated data is not correct. Error group: WINSOCK Error code:11004 Anyone know what associated data it is referring to? Thanks in advance -- iangh2 A quick Google found this on http://www.sockets.com/err_lst1.htm WSANO_DATA (11004) Valid name, no data record of requested type Berkeley description: The requested name is valid, but does not hav...

When is "close" not really "close"
I've had a strange thing occur a couple of times. When I leave at night, I leave my computer on, but close Thunderbird. That way, I can VPN in from home and view the mail store, but still access e-mail through POP3. One night, a week or so ago, I checked POP3 from home and noticed the mailbox was empty. That's impossible; I get about 500 messages a day. So, I took control of my desktop session and looked around. Thunderbird was not visible, but it was still running in the background. I have since determined that if I close it with the "X" icon at upper ...

upgrade error:"CONNECTIVITY ERROR:DB-Library: "SQL Server connection timed out."
PLEASE HELP OH WISE SYBASE GURUS! upgrading 11.9.2 to 12.0. unloaded software. rebooted server. selected "upgrade server" in Configure Sybase Servers window. typed in sa password. got "CONNECTIVITY ERROR: DB-Library: "SQL Server connection timed out." -- Chuck Boyce chuck_boyce@operamail.com http://www.geocities.com/chuck_boyce_jr/ Yahoo Messenger ID: chuck_boyce_jr http://messenger.yahoo.com AOL Instant Messenger ID: sg95m476 http://www.aol.com/aim/ ICQ Messenger ID: 41449031 http://www.icq.com ...

"Connection closed gracefully" problem
Hi, I have two Delphi applications, which communicate with Indy / Http. The client runs in a loop and sends several hundred times a request to the server. Requests are sent one by one (all from the same thread). Sometimes the server app needs up to one minute to prepare the response (time in OnCommandGet event). In this case (at least I think so), the client gets a "Connection closed gracefully" exception. If I run the server app in the debugger and stop it in the OnCommandGet event, I can stop it for 2-3 minutes. In this case, the client app is just blocked and...

vinagre "connection closed" error
I'm trying to use Vinagre on openSUSE 11.2 to make remote connection to another host. I keep getting a "connection closed" message. This happens both when I try to connect to my local XP box (which has Remote Desktop activated) or when I try to connect to a server on the network. (It looks like my firewall has VNC, VNC Server, and VNC mini-HTTP Server all as Allowed Services.) The local XP box doesn't have any trouble making a Remote Desktop Connection to the external server. With my old 11.1 installation I had no trouble making remote desktop connections. Is ...

How to Solve "The underlying connection was closed: An unexpected error occurred on a receive." Error
Hi When i want to invoke a web service method the Error happen and it says "The underlying connection was closed: An unexpected error occurred on a receive." I search on this and someone suggest to use webRequest.KeepAlive = False in GetWebRequest override method and i write this code in my refrence.vb file Protected Overrides Function GetWebRequest(ByVal uri As Uri) As System.Net.WebRequest Dim webRequest As System.Net.HttpWebRequest = MyBase.GetWebRequest(uri) webRequest.KeepAlive = False webRequest.ProtocolVersio...

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...

"Not Responding" in title bar NOT in "close firefox" error window
Name: Fish Product: Firefox Summary: "Not Responding" in title bar NOT in "close firefox" error window Comments: Firefox hangs on startup with a blank central panel and just the title bar showing. The title bar is suffixed with the windows "Not Responding" warning. This is not the Warning window that states "Firefox is already running but not responding. Please close etc. " Will occasionally give "This is embarrassing" error but will not restore old tabs or start new session. Looks as if profile or open tabs have been c...

Error Using DNS Provider Procedures--"The underlying connection was closed: Unable to connect to the remote server."
Hi, We are using the DNS Provider and DNS Client Component that comes with MPS Companion(Version 1.1). We have installed the DNS Provider in a Windows 2000 Server machine where core MPS is installed. We have installed the DNS Client Component in a Windows 2003 Server machine where DNS server is installed. When we try running the procedures CreateResourceRecord,RefreshDNSZone etc from the Windows 2000 Server using provtest utility it is throwing the floowing error "The underlying connection was closed: Unable to connect to the remote server." I am attaching a sa...

Web Exception was unhandled by usercode, "The underlying connection was closed: An unexpected error occurred on a receive." Exception error
  I am using a web service. I got the error: Web Exception was unhandled by usercode. The underlying connection was closed: An unexpected error occurred on a receive.  Thanks,Bharathi Hi, Under my environment, I can't see the figure which you gave. And based on my research, please refer to the following link below for more information about this issue. http://forums.asp.net/t/1114812.aspx   Please feel free to let me know if I’ve misunderstood anything.Sincerely,Zong-Qing LiMicrosoft Online Community Support Please remember to click “Mark as Answer” on the post ...

Web Referenced WSDL always getting "The underlying connection was closed: Unable to connect to the remote server." error
I'm getting "Exception Details: System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server." on reference.cs file.I looked up this error and there were fixes for it, if it was occuring intermittently (I applied it anyway without success).  However my error seems to be permanent.  FYI, web service is Java based and client is of course .NET based.  Does it sound like service provider issue?Thanks in advance Java Web Server shouldn't be a problem;There are many reason why this can happen:1.Check if your personal Fir...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

Web resources about - "Connection closed gracefully" errors - embarcadero.delphi.winsock

Resources last updated: 12/6/2015 11:27:32 AM