1 20 package org.apache.mina.example.netcat; 21 22 import java.net.InetSocketAddress ; 23 24 import org.apache.mina.common.IoConnectorConfig; 25 import org.apache.mina.transport.socket.nio.SocketConnector; 26 27 35 public class Main { 36 public static void main(String [] args) throws Exception { 37 if (args.length != 2) { 38 System.out.println(Main.class.getName() + " <hostname> <port>"); 39 return; 40 } 41 42 SocketConnector connector = new SocketConnector(); 44 45 ((IoConnectorConfig) connector.getDefaultConfig()) 47 .setConnectTimeout(30); 48 49 connector.connect(new InetSocketAddress (args[0], Integer 51 .parseInt(args[1])), new NetCatProtocolHandler()); 52 } 53 } 54 | Popular Tags |