本文整理汇总了Java中com.jme3.network.Client.start方法的典型用法代码示例。如果您正苦于以下问题:Java Client.start方法的具体用法?Java Client.start怎么用?Java Client.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.network.Client
的用法示例。
在下文中一共展示了Client.start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.jme3.network.Client; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException{
Logger.getLogger("").getHandlers()[0].setLevel(Level.OFF);
Server server = Network.createServer(5110);
server.start();
server.addConnectionListener(new TestNetworkStress());
for (int i = 0; i < 1000; i++){
Client client = Network.connectToServer("localhost", 5110);
client.start();
Thread.sleep(10);
client.close();
}
}
示例2: main
import com.jme3.network.Client; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException{
Serializer.registerClass(PingMessage.class);
Serializer.registerClass(PongMessage.class);
Server server = Network.createServer(5110);
server.start();
Client client = Network.connectToServer("localhost", 5110);
client.start();
server.addMessageListener(new ServerPingResponder(), PingMessage.class);
client.addMessageListener(new ClientPingResponder(), PongMessage.class);
System.out.println("Client: Sending ping message..");
client.send(new PingMessage());
Object obj = new Object();
synchronized (obj){
obj.wait();
}
}
示例3: main
import com.jme3.network.Client; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
Serializer.registerClass(TestMessage.class);
// Use this to test the client/server name version check
//Server server = Network.createServer( "bad name", 42, 5110, 5110 );
Server server = Network.createServer(5110, 5110);
server.start();
Client client = Network.connectToServer("localhost", 5110);
client.start();
client.addMessageListener(new TestThroughput(false), TestMessage.class);
server.addMessageListener(new TestThroughput(true), TestMessage.class);
Thread.sleep(1);
TestMessage test = new TestMessage();
// for( int i = 0; i < 10; i++ ) {
while (true) {
//System.out.println( "sending." );
client.send(test);
}
//Thread.sleep(5000);
}
示例4: main
import com.jme3.network.Client; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException{
Serializer.registerClass(Savable.class, new SavableSerializer());
createServer();
Client client = Network.connectToServer("localhost", 5110);
client.start();
ObjectStore store = new ObjectStore(client);
ServerAccess access = store.getExposedObject("access", ServerAccess.class, true);
boolean result = access.attachChild("Models/Oto/Oto.mesh.xml");
System.out.println(result);
}
示例5: main
import com.jme3.network.Client; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException{
Serializer.registerClass(SomeObject.class);
Serializer.registerClass(TestSerializationMessage.class);
Server server = Network.createServer( 5110 );
server.start();
Client client = Network.connectToServer( "localhost", 5110 );
client.start();
server.addMessageListener(new TestSerialization(), TestSerializationMessage.class);
client.send(new TestSerializationMessage(true));
Thread.sleep(10000);
}