An existing connection was forcibly closed by the remote host

H

Harsh Trivedi

Hi,

We have developed our application using .NET 2.0 SP1 + C#.

At the time of exporting data to the web service we are facing "An existing
connection was forcibly closed by the remote host" error.

We have find out that, if the internet connection is fast, data exported all
ok. But when the speed of internet is slow, we are getting this error.

Another thing is, we have kept time-out for 15 minutes, but this exception
message comes in 10-15 seconds. So I don't think this is timeout problem.
This is falling under System.Net.Webexception block.

I have also try to search on net, but not find any solution. Can anyone
please help me....



Thank you in advance.
 
G

Guest

You get this error when the TCP connection breaks. Are you sure you are not
loosing connectivity at all?

Simon.
 
H

Harsh Trivedi

Hi Simon,

Thanks for the time.

You mean to say...if my PDA needs to send the 200 KB data. And becasue
of slow internet connection, if it is not avail for 1-2 seconds before
sending all 200kb of data, this will come?

So what would happen in the case of GPRS, where connection will be
slow and possibolity of connection breaking for 1-2 seconds will be
higher?

This is taking my time like anything.... :(

Thanks again....
 
G

Guest

Hi,

Yes if you loose connectivity before all data is received you will loose all
the 200kb of data. My advice, certainly with regards to GPRS which is a very
low bandwidth technology, 200kb is way, way too much data to be sending at
anyone time.

Divide the data up into very small packets, around 500 bytes each. Do some
handshaking to ensure the data arrived OK, once each packet has been received
successfully, send the next one....your solution will be far slicker this way.

Simon.
 
H

Harsh Trivedi

Thanks again Simon!!!

But the question now arise is how do I break up 200 kb data in 500
bytes data?? That is how to divide big chunk of data in the small
small chunks...
 
G

Guest

What exactly are you sending? what data type? My advice is stick to simple
types such as strings, XML etc. The only problem with Web Service when used
with devices is just this, the packets will be very inflated due to the
marshalling that is required (SOAP).
If you are sending an image for example, consider converting the image to
byte arrays using the Encoding class, then try compressing that. This might
help with compresion: www.opennetcf.com/zlibce

Simon.
 
H

Harsh Trivedi

Thank you very much!!!!

I will look into zipping the data, and sent across...but the last
question....my web service is build in Java, will this zip work in
java?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top