[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Socket connection was forcibly closed by the remote host

Frederick

3/5/2008 10:11:00 AM

Hy everyone,

I have a little problem doing socket-programming.

I've made a console-application with a socket listening on a sertain port to
accept connections from other clients.

The only thing my application has to do is accept the incomming clients,
read the data and send it to a database.

Everything works fine, but now and then my socket server seems to
crash/hang.

When I check my error-handling I see that my application is throwing this
exception :

"An existing connection was forcibly closed by the remote host"

Restarting my application solves this problem.

I don't know the reason, nor how to solve it.

I've already surfed the internet al lot, but dit not come to an satisfying
answer.

Someone who can help me or who has experienced the same problem ?

Thanks,

Frederick R.




--------------------------------------------------------------------------------
Orion Electronic Solutions Rijselseweg 60, 8900 Ieper Tel: 0473 70 21 62
Fax: 057 36 46 31 E-mail: frederick@orionsolutions.be Website:
www.orionsolutions.be BTW : BE 0881 077 823


2 Answers

Murat Fidan

3/5/2008 5:23:00 PM

0

if there are too much connection at same time your servers socket may stops
working.



Peter Duniho

3/5/2008 6:28:00 PM

0

On Wed, 05 Mar 2008 02:11:06 -0800, Frederick <frederick.orion@nospam.be>
wrote:

> [...]
> Everything works fine, but now and then my socket server seems to
> crash/hang.
>
> When I check my error-handling I see that my application is throwing this
> exception :
>
> "An existing connection was forcibly closed by the remote host"
>
> [...]
> Someone who can help me or who has experienced the same problem ?

I'm sure lots of people have experienced the same problem. It's not a
very specific description of the problem, and a TCP connection being
closed somehow isn't all that uncommon.

The most common reason this would happen is some problem at the remote
end, either a buggy client, or some issue going on with its network
connection. Depending on the context, it's actually possible you've got a
malicious ISP in the middle sending fake resets. There are all sorts of
reasons this could happen, most of them having nothing to do with the
actual code, but rather something to do with the network.

So, the first step is to fix your server code so that it can reliably and
gracefully handle errors, including this one. Then, if you believe that
the reset connection is a sign of a problem elsewhere, you can move on to
dealing with that.

But you need to be able to handle that error gracefully regardless.

Pete