commit 06/10/2025

This commit is contained in:
2025-10-06 16:00:43 +07:00
parent 611745439f
commit a8e5b027ef
2 changed files with 61 additions and 38 deletions

View File

@@ -20,7 +20,7 @@ class BarixConnection(val index: UInt, var channel: String, val ipaddress: Strin
private var _onlinecounter = 0
private val udp = DatagramSocket(0)
private val inet = InetSocketAddress(ipaddress, port)
private val maxUDPsize = 1000
/**
@@ -97,8 +97,11 @@ class BarixConnection(val index: UInt, var channel: String, val ipaddress: Strin
val bb = ByteBuffer.wrap(data)
while(bb.hasRemaining()){
try {
val chunk = ByteArray(if (bb.remaining() > 1400) 1400 else bb.remaining())
val chunk = ByteArray(if (bb.remaining() > maxUDPsize) maxUDPsize else bb.remaining())
bb.get(chunk)
while(bufferRemain<chunk.size){
delay(100)
}
udp.send(DatagramPacket(chunk, chunk.size, inet))
delay(5)
} catch (e: Exception) {