java sockets

From Noah.org
Revision as of 14:41, 25 August 2012 by Root (Talk | contribs) (Created page with 'Category:Engineering Category:Java == Java Socket creator test == <pre> import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; public…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.");
        }
}