473,545 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How Can I Determine what type of IOException occurred?

I've created a Download Manager application and I'm having a problem
with some clients where for whatever reason, the remote connection is
forceably closed (whether on the client side or server side I'm not
sure).

What I want to do is catch the specific IOException that deals with
the that only. I know with the WebException there is a Status and
then a related WebExceptionSta tus enum that lets me distinguish
between the different WebExceptions. Is there an equivallent for
IOException? If not, how do I determine how to distinguish, other
than parsing the Message property, which I really don't want to do
because it isn't very clean.

Here's an example of the error I'm getting:

Error: Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host.
Stack: at System.Net.Conn ectStream.Read( Byte[] buffer, Int32 offset,
Int32 size)
Any help is appreciated.

Thanks!

Oct 12 '07 #1
1 2434
Rymfax wrote:
I've created a Download Manager application and I'm having a problem
with some clients where for whatever reason, the remote connection is
forceably closed (whether on the client side or server side I'm not
sure).

What I want to do is catch the specific IOException that deals with
the that only. I know with the WebException there is a Status and
then a related WebExceptionSta tus enum that lets me distinguish
between the different WebExceptions. Is there an equivallent for
IOException? If not, how do I determine how to distinguish, other
than parsing the Message property, which I really don't want to do
because it isn't very clean.

Here's an example of the error I'm getting:

Error: Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host.
Stack: at System.Net.Conn ectStream.Read( Byte[] buffer, Int32 offset,
Int32 size)
Unless a sub class of IOException is actually thrown, then there
are not much you can do.

Arne
Oct 13 '07 #2

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

Similar topics

17
6113
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number. "Decimal Number" sometimes serves to distinguish Base 10 numbers, eg "15", from Base 2 numbers, Eg "1111". At other times "Decimal Number" serves to...
18
2858
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the...
6
13698
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the error (seems to be happening when I try creating a directory) If dirmgr.Exists("s:\blah\" & txt_name.Text) Then lblerror.Text = lblerror.Text &...
0
2351
by: Siegfried Heintze | last post by:
This program works fine on my desktop when I grant full control of the MSAccess database to everyone. However, when I put it on my hosting service with no impersonation, I now get this error (see below). Can anyone suggest what the problem is? When I turn on impersonation, I get "unspecified error". See below. Thanks, Siegfried
3
1957
by: Dean Slindee | last post by:
I have a exception handling class that could be called from either a windows project app or a console project app. Is there any way for this class to determine which type of app called it without sending an window/console parameter from either app? Thanks, Dean Slindee
7
4401
by: MLH | last post by:
I have been using variations of the following to determine whether a functional connection to internet exists. I'm thinking of replacing it with a simple PING, but I've never seen any code for that. What is your opinion on the alternative strategy? Have you ever tried it? On Error GoTo Err_Handler Dim msXML As Object, strPageContent As...
5
4276
by: TS | last post by:
Is there a way in debug mode to determine what event caused the postback to occur without having an event handler for that event? thanks
4
1873
by: Tom Leylan | last post by:
Hi all, and to Cor, Herfried and the other "old folks", it's been a long time :-) I might be hanging around again for awhile but in the meantime I have a question. Does anybody know of a way to determine at runtime whether the app is a console or a GUI app? I have to imagine the information is available but searching around didn't yield...
6
4748
by: Zytan | last post by:
I got a System.IO.IOException in my app on another computer, so I couldn't debug it. I don't think it was a HD error. What else could throw this? Could it be from reading a webpage from the internet through a stream? Zytan
1
7437
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7773
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5984
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.