📄 client~1.jav
字号:
package test;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
public class client
{
public void run()
{
connect();
if(myserver != null)
{
dosomthing();
}
}
protected void connect()
{
try
{
org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService");
NamingContext nc = NamingContextHelper.narrow(obj);
NameComponent ncmp = new NameComponent("testif"," ");
NameComponent path[] = { ncmp };
myserver = testifHelper.narrow(nc.resolve(path));
}
catch(Exception e)
{
System.out.println("Error connection :"+e);
myserver = null;
return ;
}
System.out.println("Bound to server");
}
protected void dosomthing()
{
System.out.println("The contents of a is : "+myserver.geta());
System.out.println("The contents of abc is : "+myserver.getabc());
myserver.puta((float)23.4);
myserver.putabc("This is working");
System.out.println("The contents of a is : "+myserver.geta());
System.out.println("The contents of abc is : "+myserver.getabc());
}
public static void main(String[] args)
{
orb = ORB.init(args,null);
client c = new client();
c.run();
}
public static ORB orb;
private testif myserver;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -