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

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Definition at line 35 of file g4vrmlview.java.

Member Function Documentation

◆ main()

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

Definition at line 37 of file g4vrmlview.java.

38 {
39 try{
40 // CONST
41 final String VERSION = "1.00" ;
42 final String DATE = "August 19, 1997";
43
44 final int PORT_NO = 40801 ;
45 final String OUTPUT_FILE_HEAD = "g4" ;
46 final String OUTPUT_FILE_EXT = "wrl" ;
47 final int MAX_TRIAL = 10 ;
48
49 // local
50 int portNo = PORT_NO ;
51
52 // argument checking
53 if( args.length != 1 && args.length != 2 )
54 {
55 System.out.println( "-------------------------------");
56 System.out.println( " G4VRMLView version " + VERSION );
57 System.out.println( " " + DATE );
58 System.out.println( "-------------------------------");
59 System.out.println( "Usage: java g4vrmlview browser_name [port_number]");
60 System.out.println( " Browser_name: netscape, vrweb, etc, or NONE");
61 return ;
62 }
63
64 // VRML browser
65 String browser = new String ( args[0] ) ;
66
67 // port number
68 if( args.length == 2 )
69 {
70 portNo = Integer.parseInt( args[1] );
71 }
72
73 // make a server socket
74 ServerSocket ss = null ;
75 for ( int i = 0 ; i < MAX_TRIAL ; i++ )
76 {
77 try
78 {
79 ss = new ServerSocket( portNo );
80 System.out.println( "Waiting for requests at port " +portNo + " ...");
81 break ;
82 }
83 catch ( Exception e )
84 {
85 portNo++ ;
86 if( i >= MAX_TRIAL )
87 {
88 System.out.println( "Sockets are not available.");
89 return ;
90 }
91 }
92 } // for
93
94
95 // open connection and invoke thread
96 int nSpawn = 0 ;
97 while( true )
98 {
99 Socket socket = ss.accept(); nSpawn++ ;
100
101 System.out.println( "Connection accepted by thread " + nSpawn );
102
103 ( new g4vrmlviewThread( socket, OUTPUT_FILE_HEAD, OUTPUT_FILE_EXT , browser )).start() ;
104
105 } // while
106
107 }
108 catch ( Exception e )
109 {
110 System.out.println( e.toString() );
111 }
112 } // main()

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