[Exceptions Handling] How to understand the different type of errors



Hi all,
I need to understand what kind of error is catched in a try/catch block
because in the catch section I need to do different things depending of the
error type (sockets & co)

I have these 2 situations (generated by a DataStream.EndRead operation),
the messages are in italian language

[1^ Situation]
{System.IO.IOException}
System.IO.IOException: {"Unable to read data from the transport
connection: Operazione di I/O terminata a causa dell'uscita dal thread
oppure della richiesta di un'applicazione."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: {"Operazione di I/O terminata a causa dell'uscita dal
thread oppure della richiesta di un'applicazione"}
Message: "Unable to read data from the transport connection: Operazione
di I/O terminata a causa dell'uscita dal thread oppure della richiesta di
un'applicazione."
Source: "System"

[2^ Situation]
{System.IO.IOException}
System.IO.IOException: {"Unable to read data from the transport
connection: Connessione in corso interrotta forzatamente dall'host
remoto."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: {"Connessione in corso interrotta forzatamente
dall'host remoto"}
Message: "Unable to read data from the transport connection:
Connessione in corso interrotta forzatamente dall'host remoto."
Source: "System"

As you can see the data of the error are different only in the description
but:
1) The description is in italian, but I could find a different
configuration
2) Generally speaking I think that is not a good idea to do test on strings

So I'd like to know if there is the possibility to get an unique error code
that is different in these two situations.

Thanks in advance

Starky
.