package ChatApp; import java.math.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.*; import java.util.*; /** The main program of the Chat Server. The class has one main method that initializes the ORB object * and constructs a ChatRegistryServant that will manage registration and messaging. * After that it will wait for remote method invokations by clients. */ public class ChatServer { /** The one and only entry to the Chat Server program * @param args The program argumetns. Should include the option -ORBInitialPort and might * also include the option -ORBInitialHost if the name service is running on a deferent * machine. * to run the Chat Server type: * java -classpath . ChatApp.ChatServer -ORBInitialPort [-ORBInitialHost ] */ public static void main(String args[]) { try{ // create and initialize the ORB ORB orb = ORB.init(args, null); System.out.println("After init orb, ver 2"); // create servant and register it with the ORB ChatRegistryServant chatRegistryRef = new ChatRegistryServant(orb); orb.connect(chatRegistryRef); // get the root naming context String[] services = orb.list_initial_services(); int j = 0; for (j=0;j