473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Loss Of Network Connection During Webservice Call

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?
Aug 30 '07 #1
6 2680
"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

Aug 31 '07 #2


"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?
Aug 31 '07 #3
"Tim" <Ti*@discussions.microsoft.comwrote in message
news:A8**********************************@microsof t.com...
>

"John Saunders [MVP]" wrote:
>"Tim" <Ti*@discussions.microsoft.comwrote in message
news:A2**********************************@microso ft.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

....
1. Dim bytes() as byte
2. using ws as new wsService.FileSystem
3. bytes = ws.GetFile(fileName, startIndex, length)
4. end using
5. ........
....
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.
Good analysis.

You say that the debugger stops at line three, but that's unlikely. Look at
the Call Stack window, and turn on display of non-native code, calls to
other threads, etc. You will find that the code was waiting for something in
code _called by_ line three.

You need to see what code that is. In particular, TCP/IP based protocols
will not always time out at all parts of the communications cycle. They may
not even notice that the other side is not reachable. If this is important
to you, then you may need to implement that sort of timeout on your own.

Although this may seem like a natural part of networking, the fact is that
most applications don't need this feature. It would be wasteful for this to
be enabled on all TCP/IP connections, so it isn't.

--------------------------------------------------------------------------------
John Saunders | MVP – Windows Server System – Connected System Developer

Sep 1 '07 #4
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?
I have the same problem.
When I try to execute query to MS SQL Server (on another computer) whith ExecuteReader (C#). I unplug network cable and my application hangs.
During my research I noticed that it hangs during calls to windows sockets (WSARecv - function).
This problem occures on Windows 2003 Server.
On WinXP it works fine. When I unplug network cable it throws exception.
On WinXP WSARecv function returns control immediately.
On Win2003 it waits for timeout and doesn't understand that network is unavailable.

What Operation System do you use?

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Oct 8 '07 #5
What Operation System do you use?

Vista Business.....

I should have followed up in this thread. If I ran the debugger while
messing with the network I got the behaaviour like I described. However if I
ran teh application outside of the IDE then errors were thrown. So I had do a
little debugging outside the debugger.

Give that a try and see what happens....
Oct 8 '07 #6
=?Utf-8?B?VGlt?= <Ti*@discussions.microsoft.comwrote in
news:A8**********************************@microsof t.com:
>
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.
If you need to do file transfer, you should look at MTOM. MTOM allows you
to transfer large files in segements, thus having better control over
errors, and such. MTOM is part of WSE 3.0 add-on pack from MS.
Oct 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael R. | last post by:
Hello, Ich have some Problems with the call of a WebService! Situation: WebService is on the Internetserver The Webapplikcaion ist on the Intanetserver .... when I call the Webservice...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
0
by: John J. Hughes II | last post by:
I am using the following code to monitor a socket port. The code normally works fine unless a network connection is lost. Since both ends of the conversation on the same computer (normally) this...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
1
by: Kristijan Marin | last post by:
Hi, I have a project where components/programs run on different mashines ... and data exchange and execution of some actions on server side is done with help of webservice .... Now the same...
2
by: =?Utf-8?B?RnJpZWRoZWxtRWljaGlu?= | last post by:
I am consuming continously my own web-services on a localhost client with a rate of perhaps 35 request/response-pairs a minute. I am using "invoke-id=1", so there is at the same time only one...
4
by: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= | last post by:
Hi all, we meet a problem since we use WCF to consume java WebServices. Often the first call works then the second raises the following error : "The underlying connection was closed : " We...
1
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but...
7
by: Christiano Donke | last post by:
Is there a way to do this without having to register it computer-by-computer??? tried everything already... but nothign worked out as should.. tks..
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.