Here are several different ways to test a TCP port without telnet.
BASH (man page)
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
| package main.java.com.Documentum; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.sql.Blob; | |
| import java.sql.SQLException; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Properties; |
| function convertMS( milliseconds ) { | |
| var day, hour, minute, seconds; | |
| seconds = Math.floor(milliseconds / 1000); | |
| minute = Math.floor(seconds / 60); | |
| seconds = seconds % 60; | |
| hour = Math.floor(minute / 60); | |
| minute = minute % 60; | |
| day = Math.floor(hour / 24); | |
| hour = hour % 24; | |
| return { |
| import java.util.regex.Matcher | |
| import java.util.regex.Pattern | |
| Pattern urlPattern = Pattern.compile("\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]",Pattern.CASE_INSENSITIVE); | |
| String urlString = """This is a big string with lots of Image URL like: http://i.istockimg.com/file_thumbview_approve/69656987/3/stock-illustration-69656987-vector-of-flat-icon-life-buoy.jpg and | |
| http://i.istockimg.com/file_thumbview_approve/69943823/3/stock-illustration-69943823-beach-ball.jpg few others below | |
| http://i.istockimg.com/file_thumbview_approve/40877104/3/stock-photo-40877104-pollen-floating-on-water.jpg | |
| http://i.istockimg.com/file_thumbview_approve/68944343/3/stock-illustration-68944343-ship-boat-flat-icon-with-long-shadow.jpg | |
| """ |
| import javax.xml.transform.TransformerFactory | |
| import javax.xml.transform.stream.StreamResult | |
| import javax.xml.transform.stream.StreamSource | |
| // Load xslt | |
| def xslt= new File("MyTrasform.xsl").getText() | |
| // Create transformer | |
| def transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(xslt))) |
Here are several different ways to test a TCP port without telnet.
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
| package lan.dk.podcastserver.utils.multipart; | |
| import lan.dk.podcastserver.utils.MimeTypeUtils; | |
| import org.apache.commons.lang3.StringUtils; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import javax.servlet.ServletOutputStream; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; |
| import groovyx.net.http.HTTPBuilder | |
| import static groovyx.net.http.ContentType.* | |
| import static groovyx.net.http.Method.* | |
| int TENSECONDS = 10*1000; | |
| int THIRTYSECONDS = 30*1000; | |
| HTTPBuilder builder = new HTTPBuilder('http://www.axeda.com') | |
| //HTTPBuilder has no direct methods to add timeouts. We have to add them to the HttpParams of the underlying HttpClient |