예제 #1
0
 protected void streamOpen(Session session) {
   String identifier = session.getAddress() + ":" + session.getPort();
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_OPEN_SESSION,
           new byte[] {(byte) (identifier.length() & 0xff)},
           identifier.getBytes(StandardCharsets.UTF_8),
           new byte[] {(byte) (session.getAddress().length() & 0xff)},
           session.getAddress().getBytes(StandardCharsets.UTF_8),
           Binary.writeShort(session.getPort()),
           Binary.writeLong(session.getID()));
   this.server.pushThreadToMainPacket(buffer);
 }
예제 #2
0
 public void removeSession(Session session, String reason) throws Exception {
   String id = session.getAddress() + ":" + session.getPort();
   if (this.sessions.containsKey(id)) {
     this.sessions.get(id).close();
     this.sessions.remove(id);
     this.streamClose(id, reason);
   }
 }
예제 #3
0
 public void streamEncapsulated(Session session, EncapsulatedPacket packet, int flags) {
   String id = session.getAddress() + ":" + session.getPort();
   byte[] buffer =
       Binary.appendBytes(
           RakNet.PACKET_ENCAPSULATED,
           new byte[] {(byte) (id.length() & 0xff)},
           id.getBytes(StandardCharsets.UTF_8),
           new byte[] {(byte) (flags & 0xff)},
           packet.toBinary(true));
   this.server.pushThreadToMainPacket(buffer);
 }
예제 #4
0
 public void notifyACK(Session session, int identifierACK) {
   this.streamACK(session.getAddress() + ":" + session.getPort(), identifierACK);
 }