-
- java.net.InetAddress[] iaArr = java.net.InetAddress.getAllByName (hostName);
- IPHostEntry host = new IPHostEntry ();
- if (iaArr != null && iaArr.Length > 0) {
-
- host.HostName = iaArr[0].getHostName ();
-
- IPAddress[] ipArr = new IPAddress[iaArr.Length];
- for (int i = 0; i < iaArr.Length; i++)
- ipArr[i] = IPAddress.Parse (iaArr[i].getHostAddress ());
-
- host.AddressList = ipArr;
-
+ try {
+ java.net.InetAddress[] iaArr = java.net.InetAddress.getAllByName(hostName);
+ IPHostEntry host = new IPHostEntry();
+ if (iaArr != null && iaArr.Length > 0)
+ {
+ host.HostName = iaArr[0].getHostName();
+ IPAddress[] ipArr = new IPAddress[iaArr.Length];
+ for (int i = 0; i < iaArr.Length; i++)
+ ipArr[i] = IPAddress.Parse(iaArr[i].getHostAddress());
+
+ host.AddressList = ipArr;
+ }
+ return host;
+ } catch (java.net.UnknownHostException jUHE) {
+ throw new SocketException((int)SocketError.HostNotFound, jUHE.Message);