You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Alex Buechel <al...@gmail.com> on 2020/10/03 06:21:14 UTC
Re: Question about sending a message via udp to multiple clients
Thanks Jonathan for your answer.
I have tried this approach, but i am goint to receive a
PortUnreachableException with the information, that the current session is
closed, which is actually obvious, because there is nobody, who is
listening on another machine. In general, I need a mechanism to send
packages based on the "fire and forget"-principle, which means, that i
really don't care if the destination will receive this package or not.
So is there a possibility to tell the "session", that it should broadcast
each package and ignoring the "Destination unreachable packages"?
Thanks a lot
Alex
Am Mi., 30. Sept. 2020 um 16:26 Uhr schrieb Jonathan Valliere <
johnnyv@apache.org>:
> That's basically how it works. Only thing is, when you share a buffer
> between multiple IoSessions you need to call #slice() on your IoBuffer for
> every IoSession you write the message to.
>
> On Wed, Sep 30, 2020 at 10:06 AM Alex Buechel <al...@gmail.com>
> wrote:
>
>> Hello guys,
>>
>> Imagine i have a String-message, which i want to send to multiple udp
>> clients given by their ip addresses and ports. Do you have any short
>> example of how to publish this message efficiently to all udp clients?
>>
>> My attempt (Pseudocode):
>>
>> NioDatagramConnector connector = new NioDatagramConnector();
>>
>> foreach (client in clients) {
>>
>> connector.connect(new InetSocketAddress(client.ip, client.port));
>>
>> connector.broadcast(message);
>>
>> }
>>
>> Would this be a correct attempt, which even works for a large number of
>> items/second?
>>
>> Thanks for any advice.
>> Alex
>>
>
--
Herzliche Grüße // best regards
Alexander Büchel, M.Sc.