Lost Illusion
09/24/2021, 10:59 PMSendChannel
provided or whether I should be using openWriteChannel
and sending my data through the returned ByteWriteChannel
instead.Aleksei Tirman [JB]
09/27/2021, 9:53 AMSendChannel
because it's already available. Here is an example:
val address = NetworkAddress("127.0.0.1", 12345)
val socketBuilder: UDPSocketBuilder = aSocket(ActorSelectorManager(<http://Dispatchers.IO|Dispatchers.IO>)).udp()
val socket = socketBuilder.connect(address)
val packet = BytePacketBuilder().apply {
writeFully("test".toByteArray())
}.build()
socket.outgoing.send(Datagram(address = address, packet = packet))