Author Topic: About threads in gne  (Read 6001 times)

irado

  • User
  • *
  • Posts: 5
About threads in gne
« on: September 10, 2008, 08:24:02 PM »
I read the tutorial "Creating exhello", and I ask if the code this tutorial, the gne create one thread for the lister of the server, into it create one thread for each new connection in the server?

thanks
http://ogre.irados.org -> ogre in portuguese

irado

  • User
  • *
  • Posts: 5
Re: About threads in gne
« Reply #1 on: September 11, 2008, 05:45:22 PM »
This is one very simple quest or nobody read the quest yet?

thanks
http://ogre.irados.org -> ogre in portuguese

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: About threads in gne
« Reply #2 on: September 11, 2008, 10:09:44 PM »
From what I can remember, there is one event thread per connection. So, each ConnectionListener will be called by the event thread, but there shouldn't be more than one thread calling methods on it (unless you set it up to listen to multiple connections).

The "main" thread is still always under your control. In the exhello example, the main thread just waits for the signal to shut down the server, and on the client the main thread writes some packets to the server. The client connection listener does the receive portion.
Gillius
Gillius's Programming http://www.gillius.org/

irado

  • User
  • *
  • Posts: 5
Re: About threads in gne
« Reply #3 on: September 12, 2008, 08:47:33 AM »
Very thanks for the answer,

I am search one library of networking in c++, I think use gne. So, gne continue in development? The forum i see that works.

I do this question about threads, because i see that in the tutorial "exhello", one thread wait new connections and other thread is create automatically for each new connection come.

One application that have 1000 connections same time, i think that cannot have 1001 threads in the server for limitations of memory, for sample. One thread could have 50 connections, and not one.

So, i am begin in studys in gne, What class i use for create the connection without the create threads automatically? because the class ConnectionListener create one thread atutomatically.

thanks for help.
http://ogre.irados.org -> ogre in portuguese

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: About threads in gne
« Reply #4 on: September 12, 2008, 10:47:27 AM »
I haven't been working actively on GNE for a long time, but the SVN release contains a lot more than the last official release, so you do want to work with GNE you should work with the SVN trunk. I got close to making a release but not quite. Other than bug fixes the biggest difference with the SVN trunk version is that it has a completely redone (and much more modern) build system based on CMake.

I don't plan on working on GNE for the foreseeable future -- my development effort now has been focused on my research project RealDB: http://gillius.org/realdb/.

GNE does not scale to have many clients, and is not designed or appropriate for a massively multiplayer game. My opinion is that a library/server for a MM game requires an entirely different programming approach. So, GNE is really meant for the type of server-based game for maybe 8 or 16 players max, where the clients typically only have 1 connection and the server may be handling 8 to 32, but not something like 1000. For that, you are right, GNE will not scale because it uses 1 thread per connection.
Gillius
Gillius's Programming http://www.gillius.org/

irado

  • User
  • *
  • Posts: 5
Re: About threads in gne
« Reply #5 on: September 12, 2008, 11:28:50 AM »
Ok, thanks.

Do you suggests one network library, unless raknet, that can support 1000 connections?
http://ogre.irados.org -> ogre in portuguese

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: About threads in gne
« Reply #6 on: September 12, 2008, 11:53:51 AM »
I don't know of one, and I'm not sure whether or not Raknet is suitable for server with a large number of connections or not. I looked at the Raknet site, looks like it is gone quite a long way since I last looked at it. I found Raknet sometime after I started working on GNE and noticed that it had a lot of the same goals as GNE but had a very different design. I didn't like it at the time because it seemed very "C-like" and not a very modern design but skimming it now it seems that there is a lot more to it now with a lot of docs and object models, etc, and does a lot more than I would have gotten working in GNE. The only thing GNE would probably be able to offer now is a different (open-source) license, but Raknet appears to be free (of cost) and includes source for non-profit applications.

If Raknet has gone under continuous development since the last time that I saw it about 4 years ago, I would suspect it to be a better choice than GNE.

However, that doesn't really answer your question on a server to support 1000 connections. You'll have to look at Raknet yourself and decide that.
Gillius
Gillius's Programming http://www.gillius.org/

irado

  • User
  • *
  • Posts: 5
Re: About threads in gne
« Reply #7 on: September 12, 2008, 12:33:34 PM »
Thanks for your attention

I will continue searching. I want find one networking library free that suport this connections, but i think that i cannot find one free.

If i dont find i will try do something using hawknl and your threads.

thanks again.
http://ogre.irados.org -> ogre in portuguese