client~1.jav
来自「its a chat server code using javascript」· JAV 代码 · 共 68 行
JAV
68 行
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 + =
减小字号Ctrl + -
显示快捷键?