Author Topic: HELP for noob: how propagate message to all client connected ???  (Read 4083 times)

hurricane

  • User
  • *
  • Posts: 1
HELP for noob: how propagate message to all client connected ???
« on: February 20, 2009, 04:27:55 AM »
Hi gillius, first thanks for this nice library!!!

I am tring to use your library with my project but i don't find a way to propagate a client-packet that arrive to the server towards everybody connected clients...

So if i have this client:

C1, C2, C3, C4, ....., C(N)
and server S

if arrive a message from C1 to S i need that this message is propagate to clients C2, C3, C4, ...., C(N)

I didn't find any list/method about it in the API....

Thanks a lot for you help

Bye, Martin

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: HELP for noob: how propagate message to all client connected ???
« Reply #1 on: February 20, 2009, 09:09:31 AM »
This was something that I was working on when I stopped doing significant on GNE about 4 years ago. This is part of the high-level API, which is to partition sets of connections into channels.

http://www.gillius.org/gne/docs-0.75.0/classGNE_1_1ChannelProvider.html

The idea is that you might have one channel for all players, another for players on team A, and another for players on team B, or however else you want it. There is a send method that sends to every connection on the channel except one that you specify (specifically to handle your case of broadcast from C1 to C2, C3,...CN). A connection can be part of more than one channel at a time.

I'll be honest and I'm not sure how far I got in the actual coding of the class. If you do decide to use GNE, I very highly suggest using the latest SVN version -- it's "stable" and I got it almost to the point where I was about to make another release, so it should be better than the current version without breaking anything.
Gillius
Gillius's Programming http://www.gillius.org/