private void sendOKAndDataToRequest(ConnectionInfo info, int id) { ByteBuffer buf = ByteBuffer.allocate(Byte.SIZE + Integer.SIZE + Integer.SIZE + Integer.SIZE); buf.put(RESPONCECODES.OK); buf.putInt(info.udpConnection.socket().getLocalPort()); buf.putInt(id); buf.putInt(info.sharedSecret); buf.flip(); try { info.tcpConnection.write(buf); } catch (IOException e) { info.closeOpenSockets(); } }
protected void sendErrorCodeToRequestAndClose(byte code, ConnectionInfo info) { sendErrorCodeToRequest(code, info.tcpConnection); info.closeOpenSockets(); }