Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
g4vrmlview Class Reference

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Definition at line 36 of file g4vrmlview.java.

Member Function Documentation

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

Definition at line 38 of file g4vrmlview.java.

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

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