views:

59

answers:

1

I have developed a application that run on a device with Wince 5.0. I make web service calls using WLAN. The application works fine if the app server is with the LAN. In the other case, it raises a exception only for the first time when the application tries to communicate with the appserver. If the application is launched for the second time it does not raise any exception.

The stack trace:

Tuesday, April 13, 2010 - 10:03:04 AM: Unable to connect to the remote server at System.Net.HttpWebRequest.finishGetResponse() at System.Net.HttpWebRequest.GetResponse() at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult) at Aarya.Service.MIDServiceProxy.ManagementService.MIDAuthenticateLoginandRole(String sUsername, String sPassword) at Aarya.Modules.MID.ProxyWrapper.ManagementServiceWrapper.MIDAuthenticateLoginandRole(String sUsername, String sPassword) at Aarya.MID.AuthenticateManager.Logon(String loginName, String password) at Aarya.MID.Shell.PerformAsyncLogin()


A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.ConnectNoCheck(EndPoint remoteEP) at System.Net.Sockets.Socket.Connect(EndPoint remoteEP) at System.Net.Connection.doConnect(IPEndPoint ep) at System.Net.Connection.connect(Object ignored) at System.Threading.ThreadPool.WorkItem.doWork(Object o) at System.Threading.Timer.ring()

A: 

My guess is that the first time it is launched you don't have a network connection. Your web service call then calls down into connection manager, which then powers up the radio, contacts the DHCP server, gets an address, then creates the network connection.

All of this process is probably taking too long and your app time's out. Once you've made the first call, Connection Manager keeps that connection open for a while and your second run uses that existing connection, so it succeeds.

Your app needs to be handling timeouts anyway (what if the network is out of range or unreachable), so proper situation handling should take care of this anyway.

ctacke

related questions