IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Runtime.Util.Java.Net.SocketExceptionExtensions Class Reference

Extensions for working with Sockets. More...

Static Public Member Functions

static global::java.io.IOException ToIOException (this SocketException self)
 Converts the given SocketException to a global::java.io.IOException.
 

Detailed Description

Extensions for working with Sockets.

Definition at line 10 of file SocketExceptionExtensions.cs.

Member Function Documentation

◆ ToIOException()

static global.java.io.IOException IKVM.Runtime.Util.Java.Net.SocketExceptionExtensions.ToIOException ( this SocketException self)
static

Converts the given SocketException to a global::java.io.IOException.

Parameters
self
Returns
Exceptions
ArgumentNullException

Definition at line 21 of file SocketExceptionExtensions.cs.

22 {
23 if (self is null)
24 throw new ArgumentNullException(nameof(self));
25
26 switch (self.SocketErrorCode)
27 {
28 case SocketError.Interrupted:
29 throw new global::java.io.InterruptedIOException(self.Message);
30 case SocketError.AddressAlreadyInUse:
31 case SocketError.AddressNotAvailable:
32 case SocketError.AccessDenied:
33 return new global::java.net.BindException(self.Message);
34 case SocketError.NetworkUnreachable:
35 case SocketError.HostUnreachable:
36 return new global::java.net.NoRouteToHostException(self.Message);
37 case SocketError.TimedOut:
38 return new global::java.net.SocketTimeoutException(self.Message);
39 case SocketError.ConnectionRefused:
40 return new global::java.net.PortUnreachableException(self.Message);
41 case SocketError.ConnectionReset:
42 return new global::sun.net.ConnectionResetException(self.Message);
43 case SocketError.HostNotFound:
44 return new global::java.net.UnknownHostException(self.Message);
45 case SocketError.ProtocolNotSupported:
46 return new global::java.net.ProtocolException(self.Message);
47 default:
48 return new global::java.net.SocketException($"{self.Message} [{self.SocketErrorCode}]");
49 }
50 }

The documentation for this class was generated from the following file: