Forum Discussion
Joe_Tran
7 years agoAdvisor
Since we're posting !groovy workarounds---here is one I'm using for telnet:
hostname = 'internal.server.local' port = 22 try { s = new Socket(hostname, port) println "Connected to $hostname on port $port" s.close() return(0) } catch (ConnectException ce) { println ce.toString() return(1) } catch (BindException be) { println be.toString() return(4) } catch (NoRouteToHostException re) { println re.toString() return(2) } catch (PortUnreachableException pe) { println pe.toString() return(3) } catch (Exception e) { println e.toString() return(5) }
Related Content
- 5 months ago