Intermittent SocketException on Web Service Connection

G

Guest

I'm running a CompactFramework 2.0 application that connects to and receives
data from a web service running on an intranet server. Sometimes the data is
retrieved and sometimes the application terminates with the following
exception:

System.Net.Sockets.SocketException occurred
Message="An existing connection was forcibly closed by the remote host"
ErrorCode=10054
NativeErrorCode=10054
StackTrace:
at System.Net.Sockets.Socket.ReceiveNoCheck()
at System.Net.Sockets.Socket.Receive()
at System.Net.Connection.Read()
at System.Net.HttpWebRequest.fillBuffer()
at System.Net.HttpWebRequest.getLine()
at System.Net.HttpWebRequest.parseResponse()
at System.Net.HttpWebRequest.startReceiving()
at System.Net.Connection.startReceiving()
at WorkItem.doWork()
at System.Threading.Timer.ring()

For test purposes I'm putting the application in a hard loop to retrieve the
data so I know I'm getting the same data back on each request. The web
service is a .NET 2.0 service, running on a Win 2K3 Enterprise server under
IIS 6.0. The web service is logging successful completion just before
returning the data (a System.Data.DataSet), and I'm not catching an exception
from the return statement itself.

I'm using ActiveSync 4.1.0, and I've received the error on both a physical
device and an emulator launched from VS2005.

I can use the web service from a desktop application all day long (and into
the night) without error.

Any thoughts on how I might resolve this problem?

Thanks,
Mike
 
I

Ilya Tumanov [MS]

Generally you should anticipate periodic networking issues by catching
exceptions and retrying number of times before failing.

I would also suggest trying real network card instead of AS pass-through.



--
Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Guest

Thanks, Ilya. I agree that your suggestions are good practice, but it sure
looks to me like I've hit some flaw in the PDA/desktop connection.
Unfortunately, I'm not able to provide a means of reproducing the problem due
to the nature of the data, but I was hoping someone else encountered this
problem and found a solution.

Mike
 

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