java sockets

From Noah.org
Jump to: navigation, search


Java Socket creator test

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class SocketCreator {
    public static void main(String[] args) {
            long _begin = System.currentTimeMillis();
            try {
                new Socket("10.10.10.10", 100);
            } catch (UnknownHostException exception) {
                exception.printStackTrace();
            } catch (IOException exception) {
                exception.printStackTrace();
            }
            long _end = System.currentTimeMillis();
            System.out.println("It took: " + (_end - _begin) + " ms.");
        }
}