"John Saunders [MVP]" wrote:
"Tim" <Ti*@discussions.microsoft.comwrote in message
news:A2**********************************@microsof t.com...
I have an app that calls a webmethod. Everything works fine except when
you,
the client, loses network connectivity during the request. When the
connection is lost the client applications hangs.
I tried setting the Timeout property on the client but still an error is
never raised. Is there a workaround for this?
Is there a workaround for what? In what way does the client hang? In what
part of the conversation does the client hang?
--------------------------------------------------------------------------------
John Saunders | MVP – Windows Server System – Connected System Developer
Lets start with what I want to do. I have mobile users that will have a
client that will randomly phone home to look for updated presentations,
literature, videos, etc. The client computer will decide what is new, updated
or has been deleted . Then the client will download the files in chunks and
save them to a designated place until completed. Then the file will be moved
to its final destination.
We want this to be automatic, no user intervention. The problem is if it is
in the middle of a download (webmethod call) when they disconnect from there
wireless connection or LAN the application will not complete the following
code.
1. Dim bytes() as byte
2. using ws as new wsService.FileSystem
3. bytes = ws.GetFile(fileName, startIndex, length)
4. end using
5. ........
GetFile is a method that returns x number of bytes of a file starting at an
offset (startIndex) and return x (length) number of bytes.
This function works great under normal conditions. Now lets say the service
is invoked on line 3. This function may take a while to return a value
depending on the amount of data you want returned. Now you unplug the network
cable before the method returns from the client computer which is calling
this method. The method will not return and an exception is not raised. I
have let it sit there for 5-10 minutes and then I do a break all and the
debugger stops at line 3.
I have tried setting the .Timeout property (ws.Timeout = 5000) and an
exception is not raised. I am using synchronous calls and really do not want
to goto an asynchronous design (I do not know if it would make a difference).
Shouldn't an exception be raised within some reasonable timeframe? Setting
the .Timeout does not seem to work. I just want the webmethod to return or
raise an exception so that I know to try again later.
Have any suggestions?