Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;

public class Main {
    public static void main(String[] argv) throws Exception {
        SocketChannel sChannel = SocketChannel.open();
        sChannel.configureBlocking(false);

        sChannel.connect(new InetSocketAddress("hostName", 12345));

        while (!sChannel.finishConnect()) {
            // Do something else
        }

    }
}