Home All Groups Group Topic Archive Search About

an existing connection was forcibly closed by the remote host

Author
17 Nov 2006 2:23 AM
figelwump
Hello,

I am developing an HTTP/1.1 proxy server in c#.net.  I am encountering
the following exception when I try to send the response body back to
the client:  "An existing connection was forcibly closed by the remote
host".  This exception is thrown by the Socket.Send() method (where the
specific socket in this case is the client socket).

Additionally, if I do not send the response headers back to the client,
I do not get this error when sending the response body.

Any ideas/pointers on this issue?

Thanks,
Vishal

Author
17 Nov 2006 9:11 AM
Vadym Stetsyak
Hello, figelw***@gmail.com!

What are the headers that you send back? Since, you control
proxy to can change response headers in the way you like.

For instance, if response contains header "connection : close" you
can remove it, and then send response to the client.

Have a look at
http://vadmyst.blogspot.com/2006/01/proxy-server-behavior-with-different.html )

f> I am developing an HTTP/1.1 proxy server in c#.net.  I am
f> encountering
f> the following exception when I try to send the response body back to
f> the client:  "An existing connection was forcibly closed by the
f> remote
f> host".  This exception is thrown by the Socket.Send() method (where
f> the
f> specific socket in this case is the client socket).

f> Additionally, if I do not send the response headers back to the
f> client,
f> I do not get this error when sending the response body.

f> Any ideas/pointers on this issue?

f> Thanks,
f> Vishal


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Author
17 Nov 2006 8:32 PM
figelwump
Thanks for the pointer.  I also suspected that the issue was related to
the headers, so I did try removing the the Connection: close header
from the response.  This did not change the exception.  Also I am not
setting the Connection header in the request I pass to the server.


Vadym Stetsyak wrote:
Show quote
> Hello, figelw***@gmail.com!
>
> What are the headers that you send back? Since, you control
> proxy to can change response headers in the way you like.
>
> For instance, if response contains header "connection : close" you
> can remove it, and then send response to the client.
>
> Have a look at
> (  http://vadmyst.blogspot.com/2006/01/proxy-server-behavior-with-different.html )
>
> f> I am developing an HTTP/1.1 proxy server in c#.net.  I am
> f> encountering
> f> the following exception when I try to send the response body back to
> f> the client:  "An existing connection was forcibly closed by the
> f> remote
> f> host".  This exception is thrown by the Socket.Send() method (where
> f> the
> f> specific socket in this case is the client socket).
>
> f> Additionally, if I do not send the response headers back to the
> f> client,
> f> I do not get this error when sending the response body.
>
> f> Any ideas/pointers on this issue?
>
> f> Thanks,
> f> Vishal
>
>
> --
> Regards, Vadym Stetsyak
> www: http://vadmyst.blogspot.com

AddThis Social Bookmark Button