473,385 Members | 1,901 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,385 software developers and data experts.

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 WebExceptionStatus 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.ConnectStream.Read(Byte[] buffer, Int32 offset,
Int32 size)
Any help is appreciated.

Thanks!

Oct 12 '07 #1
1 2433
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 WebExceptionStatus 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.ConnectStream.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
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....
18
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...
6
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...
0
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...
3
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...
7
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...
5
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
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...
6
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.