Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
g4mini Class Reference

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Definition at line 31 of file g4mini.java.

Member Function Documentation

◆ main()

static void g4mini.main ( String[]  args)
inlinestatic

Definition at line 33 of file g4mini.java.

34 {
35 try{
36
37 // port number
38 final int DEFALUT_PORT_NO = 40801 ;
39 int portNo = DEFALUT_PORT_NO ;
40
41 // argument checking
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 // open connection
51 Socket socket = new Socket( server, portNo ) ;
52
53 // get input stream from file
54 BufferedReader br
55 = new BufferedReader ( new FileReader ( src ) ) ;
56
57 // get output stream to socket
58 BufferedWriter bw
59 = new BufferedWriter ( new OutputStreamWriter ( socket.getOutputStream() ) ) ;
60
61 // file ==> socket
62 String line ;
63 while ( (line = br.readLine()) != null )
64 {
65 bw.write( line );
66 bw.newLine() ;
67 bw.flush () ;
68 }
69
70 // close streams
71 br.close();
72 bw.close();
73 socket.close() ;
74 }
75
76 catch( Exception e )
77 {
78 System.out.println( e.toString() );
79 }
80 } // main

The documentation for this class was generated from the following file: