LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-23-2006, 10:47 AM   #1
vivekr
Member
 
Registered: Nov 2005
Location: Coimbatore,India
Distribution: Fedora Core4
Posts: 68

Rep: Reputation: 15
Problem with CORBA (impl language Java)


Code:
import Chat.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
import java.util.*;

public class ChatClientImpl extends ChatClientPOA
{
  static Vector clients=new Vector();
  public void send(String message)
  { 
  	  
  }

  public static Binding[] listBindings(NamingContextExt nc,int max)
	     throws org.omg.CORBA.UserException
  {
	   Binding[]   basicList;
	   BindingIterator bIter;
	
	   org.omg.CORBA.Object obj;	   
	
	   BindingListHolder basicList_out=new BindingListHolder();
	   BindingIteratorHolder bIter_out= new BindingIteratorHolder();
	   nc.list(max,basicList_out,bIter_out);
	   basicList = basicList_out.value;
	   bIter = bIter_out.value;
	
	   int   max_remaining = max - basicList.length;
	   boolean moreBindings = (bIter!=null);
	
	   if (moreBindings) {
	      while (moreBindings && (max_remaining > 0) ) {
	        Binding[] tmpList;
	        Binding[] oldList;
	        BindingListHolder tmpList_out=new BindingListHolder();
	        moreBindings = bIter.next_n(max,tmpList_out);
	        tmpList = tmpList_out.value;
	        //Append 'tmpList' to 'basicList'
	        oldList = basicList;
	        basicList = new Binding[oldList.length+tmpList.length];
	        for (int i=0; i < oldList.length; i++) {
	          basicList[i] = oldList[i];
	        }
	        for (int i=0; i < tmpList.length; i++) {
	          basicList[i+oldList.length] = tmpList[i];
	        }
	        // Re-calculate 'max_remaining'
	        max_remaining = max - basicList.length;
	     }
	     bIter.destroy();
	 }
	 return basicList;
  }
  
  public void receive(String message)
  {
  	 	System.out.println(message);
  } 
  
  public static void main(String args[])
  {
  	try
  	{  	
	  	 ORB orb=ORB.init(args,null);
	  	 POA poa=POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
	  	 poa.the_POAManager().activate();
	  	 ChatClientImpl client=new ChatClientImpl();
	  	// client.setORB(orb);
	     org.omg.CORBA.Object ref=poa.servant_to_reference(client);
		 ChatClient clientRef=ChatClientHelper.narrow(ref);
		 org.omg.CORBA.Object objRef=orb.resolve_initial_references("NameService");
		 NamingContextExt context=NamingContextExtHelper.narrow(objRef);
		 java.io.DataInputStream in=new java.io.DataInputStream(System.in);
		 String name=in.readLine();
		 clients.add(name);
		 NameComponent path[]=context.to_name(name);
		 System.out.println("client binded..");
		 context.rebind(path, clientRef);
		 String msg=in.readLine();		 
		 Binding[] bindings=ChatClientImpl.listBindings(context,20);
		 for(int i=0;i<bindings.length;i++)
		 {					 	 
		 /*	 String name2=(String) e.nextElement();
		 	 System.out.println("Sent to "+name2);*/
			 ChatClient chat= ChatClientHelper.narrow(context.resolve(bindings[i].binding_name));
			 chat.receive("Hai");
		 }
		 orb.run();	
		 orb.shutdown(true);
  	}
  	catch(Exception e)
  	{
  		 e.printStackTrace();
  	}
  }
}
I am in the preliminary stages of creating a chat application. Here to begin with application runs perfectly.. But after resloving other clients. It goes wild
Code:
@client1:
I:\Vivek\CORBA\ChatProj>java ChatClientImpl
sanjay
client binded..
hai
Hai
Sep 23, 2006 9:08:25 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectio
nImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR
_TEXT; hostname: 192.168.1.69; port: 2588"
.....


@client2:
I:\Vivek\CORBA\ChatProj>java ChatClientImpl
vivek
client binded..
Hai
hello
Hai
Sep 23, 2006 9:08:34 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectio
nImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR
_TEXT; hostname: 192.168.1.69; port: 3210"
.....

Can anyone suggest me a good alternative to get rid of this behaviour.. Thanks in advance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding client to server's list failed, CORBA error: IDL:omg.org/CORBA/COMM_FAILURE:1. wlfdgcrkz Linux - Software 2 01-26-2008 01:28 PM
CORBA-orbit problem between hosts Ojp Programming 0 05-16-2006 12:08 AM
Script Java on Linux with Luban Language peterxhuang Programming 0 12-21-2005 01:12 PM
java compiler+error ouput language bai_design Programming 0 10-06-2004 07:41 PM
Editor for Java programming language. ICO Linux - Software 11 02-03-2004 07:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration