1

Is there any functionality provided by NIO package for sending messages to all active ClientChannels?

I can just loop through all the keys anytime I am reading from some Channel, like it is done here, but I am interested in using specifically NIO functionality (registering channels with OP_WRITE etc.)

Mikayel
  • 117
  • 11

1 Answers1

2

Java NIO channels are a thin wrapper around OS sockets.

Just like there is no way to send one packet to multiple sockets, there is no way to send one message to multiple channels in a single call.

You might want to look into IP multicasting using MulticastSocket, but it requires the network to support it.

rustyx
  • 80,671
  • 25
  • 200
  • 267