import java.net.InetAddress; import java.net.ServerSocket; public class SS { public static void main(String[] args) throws Throwable { InetAddress inet = InetAddress.getByName("192.168.6.110"); ServerSocket ss = new ServerSocket(7001, 100, inet); ss.accept(); } }
After that, if you run
ss -ln | grep 7001
you should see your fish swimming, and be able to telnet into it.
(ah of course: javac SS.java, java SS) To check if something is listening on an IP/port:
import java.net.InetAddress; import java.net.Socket; public class CS { public static void main(String[] args) throws Throwable { InetAddress inet = InetAddress.getByName("192.168.6.110"); Socket so = new Socket(inet, 7001); so.getInputStream(); } }
No comments:
Post a Comment