1 26 27 package org.objectweb.benchmark.corba.latency; 28 29 import java.io.InputStream ; 31 import java.io.PrintStream ; 32 import java.net.ServerSocket ; 33 import java.net.Socket ; 34 import java.util.Properties ; 35 36 37 44 public class IORServer 45 { 46 52 55 private String ior; 56 57 58 61 private int port; 62 63 69 72 public IORServer(String ior) 73 throws Exception 74 { 75 this.ior=ior; 76 77 Properties props = new Properties (); 78 InputStream propStream = getClass().getClassLoader().getResourceAsStream("build.properties"); 79 props.load(propStream); 80 81 port = Integer.parseInt( props.getProperty("ior.port") ); 82 } 83 84 90 93 public void listen() 94 throws Exception 95 { 96 ServerSocket ss = new ServerSocket (port); 97 Socket s = ss.accept(); 98 99 PrintStream out = new PrintStream (s.getOutputStream()); 100 101 out.println(this.ior); 103 104 s.close(); 105 } 106 } 107 | Popular Tags |