EIdSocketError Socket Error # 10054 Connection reset by peer
I am getting this exception in only few machines of my program where I am
using TIdHTTPServer component.
Could anyone help me out on this ?
Thanks
Venu
> EIdSocketError Socket Error # 10054 Connection reset by peer
That error means the other party closed the connection ungracefully, such as
by rebotting the machine.
> I am getting this exception in only few machines of my program
> where I am using TIdHTTPServer component.
Then don't worry about it. If a client is disconnecting while TIdHTTPServer
is reading/writing from/to it, then TIdHTTPServer will handle the socket
error internally for you.
Gambit
I am still getting this error
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:47ea7dde$1...@newsgroups.borland.com...
> The Server and client is in the same application, infact in the same form.
Then your OS is likely messed up. It should not be possible to get that
particular error on the same machine.
> I am still getting this error
What does your actual code look like? Where are are seeing the error
exactly - client-side or server-side? What are you doing when the error
occurs?
Gambit
On "TfrmServer.httpServerCommandGet" I am doing the page processing.
At one instance, I need to run an external function (which takes 5-7 secs)
to do some database processing and
I have to show the corresponding error page.
During this time, it comes up with an access violation with the
"EIdSocketError Socket Error # 10054 Connection reset by peer"
The call trace looks like this
:7c812a5b kernel32.RaiseException + 0x52
IdStack.TIdStack.RaiseSockError(10054)
IdTCPConnection.TIdTCPConnection.WriteBuffer((no value), 105,True)
IdTCPConnection.TIdTCPConnection.FlushWriteBuffer(-1);
IdTCPConnection.TIdTCPConnection.CloseWriteBuffer
IdCustomHTTPServer.TIdHTTPResponseInfo.WriteHeader
IdCustomHTTPServer.TIdCustomHTTPServer.DoExecute($21302E0)
IdTCPServer.IdPeerThread.Run
IdThread.TIdThread.Execute
Classes.ThreadProc($21302E0)
System.ThreadWrapper($2195610)
:7c80b683 ; C:\WINDOWS\system32\kernel32.dll
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:47eb499b$1...@newsgroups.borland.com...
>I am following the example
> http://www.delphi3000.com/article.asp?ID=3081
That article is quite old (2005).
> On "TfrmServer.httpServerCommandGet" I am doing the page processing.
That code is not thread-safe. And much of its logic is redundant as well,
as it is duplicating logic that TIdHTTPServer natively implements
internally.
> At one instance, I need to run an external function (which takes
> 5-7 secs) to do some database processing and I have to show
> the corresponding error page.
>
> During this time, it comes up with an access violation with the
> "EIdSocketError Socket Error # 10054 Connection reset by peer"
The only way that error can occur is if the socket is being disconnected
abnormally on the client side while waiting for the server's reply. Changes
are, the client has a timeout implemented on its end, and is not closing its
socket endpoint properly.
> The call trace looks like this
You did not say which version of Indy 9 you are using. If you ave not
already done so, make sure you are using the latest Indy 9.0.50 snapshot,
and then see if the problem continues.
Gambit
How to make the client socket connection to stay alive, I am using the
webbrowser component. Any ideas ?
> How to make the client socket connection to stay alive
There is no way to force that on the server side.
> I am using the webbrowser component.
By default, the HTTP 1.0 protocol does not use keep-alives, unless the
client explicitally asks for them. The HTTP 1.1 protocol, on the other
hand, always uses keep-alives, unless the client explicitally asks not to.
Either way, TIdHTTPServer has a KeepAlive property to support that. It is
set to False initially, so you will have to set it to True yourself. But it
is still up to the client to decide whether to use keep-alives or not.
Gambit
Is there a way to force from the client side