1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.mina.examples.netcat;
20
21 import java.net.InetSocketAddress;
22
23 import org.apache.mina.io.socket.SocketConnector;
24
25 /***
26 * (<b>Entry point</b>) NetCat client. NetCat client connects to the specified
27 * endpoint and prints out received data. NetCat client disconnects
28 * automatically when no data is read for 10 seconds.
29 *
30 * @author Trustin Lee (trustin@apache.org)
31 * @version $Rev: 165577 $, $Date: 2005-05-02 13:22:31 +0900 (월, 02 5월 2005) $,
32 */
33 public class Main
34 {
35 public static void main( String[] args ) throws Exception
36 {
37 if( args.length != 2 )
38 {
39 System.out.println( Main.class.getName() + " <hostname> <port>" );
40 return;
41 }
42
43
44 SocketConnector connector = new SocketConnector();
45
46
47 connector.connect( new InetSocketAddress( args[ 0 ], Integer
48 .parseInt( args[ 1 ] ) ), 60, new NetCatProtocolHandler() );
49 }
50 }