public KryoSerialization (Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new Input(byteBufferInputStream, 512); output = new Output(byteBufferOutputStream, 512); }
private void acceptOperation (SocketChannel socketChannel) { Connection connection = newConnection(); connection.initialize(serialization, writeBufferSize, objectBufferSize); connection.endPoint = this; UdpConnection udp = this.udp; if (udp != null) connection.udp = udp; try { SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel); selectionKey.attach(connection); int id = nextConnectionID++; if (nextConnectionID == -1) nextConnectionID = 1; connection.id = id; connection.setConnected(true); connection.addListener(dispatchListener); if (udp == null) addConnection(connection); else pendingConnections.put(id, connection); RegisterTCP registerConnection = new RegisterTCP(); registerConnection.connectionID = id; connection.sendTCP(registerConnection); if (udp == null) connection.notifyConnected(); } catch (IOException ex) { connection.close(); if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex); } }
public JsonSerialization () { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); json.setWriter(writer); }
public KryoSerialization (Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new ByteBufferInput(); output = new ByteBufferOutput(); }
public MyKryoSerialization(Kryo kryo, int objectSize) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new Input(byteBufferInputStream, objectSize); output = new Output(byteBufferOutputStream, objectSize); }
public KryoSerialization(Kryo kryo) { this.kryo = kryo; kryo.register(RegisterTCP.class); kryo.register(RegisterUDP.class); kryo.register(KeepAlive.class); kryo.register(DiscoverHost.class); kryo.register(Ping.class); input = new ByteBufferInput(); output = new ByteBufferOutput(); }
private void acceptOperation(SocketChannel socketChannel) { Connection connection = newConnection(); connection.initialize(serialization, writeBufferSize, objectBufferSize); connection.endPoint = this; UdpConnection udp = this.udp; if (udp != null) connection.udp = udp; try { SelectionKey selectionKey = connection.tcp.accept(selector, socketChannel); selectionKey.attach(connection); int id = nextConnectionID++; if (nextConnectionID == -1) nextConnectionID = 1; connection.id = id; connection.setConnected(true); connection.addListener(dispatchListener); if (udp == null) addConnection(connection); else pendingConnections.put(id, connection); RegisterTCP registerConnection = new RegisterTCP(); registerConnection.connectionID = id; connection.sendTCP(registerConnection); if (udp == null) connection.notifyConnected(); } catch (IOException ex) { connection.close(); if (DEBUG) debug("kryonet", "Unable to accept TCP connection.", ex); } }
public JsonSerialization() { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); json.setWriter(writer); }
public JsonSerialization () { json.addClassTag("RegisterTCP", RegisterTCP.class); json.addClassTag("RegisterUDP", RegisterUDP.class); json.addClassTag("KeepAlive", KeepAlive.class); json.addClassTag("DiscoverHost", DiscoverHost.class); json.addClassTag("Ping", Ping.class); }