|
static void | main (String[] args) |
|
Definition at line 31 of file g4mini.java.
◆ main()
static void g4mini.main |
( |
String[] |
args | ) |
|
|
inlinestatic |
Definition at line 33 of file g4mini.java.
34 {
35 try{
36
37
38 final int DEFALUT_PORT_NO = 40801 ;
39 int portNo = DEFALUT_PORT_NO ;
40
41
42 if( args.length != 2 )
43 {
44 System.out.println( "Usage: java g4mini src_file server_hostname");
45 return ;
46 }
47 String src = args[0];
48 String server = args[1];
49
50
51 Socket socket = new Socket( server, portNo ) ;
52
53
54 BufferedReader br
55 = new BufferedReader ( new FileReader ( src ) ) ;
56
57
58 BufferedWriter bw
59 = new BufferedWriter ( new OutputStreamWriter ( socket.getOutputStream() ) ) ;
60
61
62 String line ;
63 while ( (line = br.readLine()) != null )
64 {
65 bw.write( line );
66 bw.newLine() ;
67 bw.flush () ;
68 }
69
70
71 br.close();
72 bw.close();
73 socket.close() ;
74 }
75
76 catch( Exception e )
77 {
78 System.out.println( e.toString() );
79 }
80 }
The documentation for this class was generated from the following file: