Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (continueRunning) {
- buffer.clear()
- val address = socket.receive(buffer)
- buffer.flip()
- // Всегда null
- if (address != null) {
- val data = ByteArray(buffer.limit())
- buffer.get(data, 0, buffer.limit())
- val packet = DatagramPacket(data, data.size, address)
- threadPool.submit { packetProcessor.processPacket(packet) }
- }
- val answer = answerQueue.poll()
- // Всегда null
- if (answer != null) socket.send(ByteBuffer.wrap(answer.data), answer.socketAddress)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement