#include <ServeurPrincipal.h>
Collaboration diagram for ServeurPrincipal:
Public Member Functions | |
ServeurPrincipal (unsigned int port) | |
Classe démarrant le serveur principal. | |
~ServeurPrincipal () | |
void | AttendreClient () |
Méthode permettant d'attendre les clients. | |
Private Attributes | |
Socket * | mSocketEcoute |
Socket d'écoute TCP. | |
TableauDyn< TraitementClient * > | mTC |
Tableau de pointeurs sur les threads traitant les clients. |
Definition at line 34 of file ServeurPrincipal.h.
ServeurPrincipal::ServeurPrincipal | ( | unsigned int | port | ) | [inline] |
Classe démarrant le serveur principal.
port | Port TCP d'écoute |
Definition at line 41 of file ServeurPrincipal.h.
References SocketException::Afficher(), AttendreClient(), and mSocketEcoute.
00041 { 00042 cout<<"SP ServeurPrincipal::Création du serveur principal"<<endl; 00043 try{ 00044 mSocketEcoute=new SocketTCP((unsigned int)port); 00045 } catch(SocketException e){ 00046 e.Afficher(); 00047 exit(-1); 00048 } 00049 AttendreClient(); 00050 }
Here is the call graph for this function:
ServeurPrincipal::~ServeurPrincipal | ( | ) | [inline] |
Definition at line 52 of file ServeurPrincipal.h.
References Singleton< T >::KillInstance(), and mSocketEcoute.
00052 { 00053 cout<<"~ServeurPrincipal()"<<endl; 00054 delete mSocketEcoute; 00055 BdD::KillInstance(); 00056 Partie::KillInstance(); 00057 }
Here is the call graph for this function:
void ServeurPrincipal::AttendreClient | ( | ) | [inline] |
Méthode permettant d'attendre les clients.
A chaque connexion un thread de type TraitementClient est créé.
Definition at line 62 of file ServeurPrincipal.h.
References Socket::Accept(), TableauDyn< T >::ConsQueue(), mSocketEcoute, and mTC.
Referenced by ServeurPrincipal().
00062 { 00063 cout<<"SP ServeurPrincipal::Attente des clients"<<endl; 00064 Socket *s; 00065 unsigned int nb=0; 00066 while(1){ 00067 s=mSocketEcoute->Accept(); 00068 cout<<endl<<"SP ServeurPrincipal::Connexion d'un client"<<endl; 00069 //Passer la nouvelle socket à un thread qui va gérer le traitement 00070 mTC.ConsQueue(new TraitementClient(s)); 00071 mTC[nb]->Demarrer(); 00072 nb++; 00073 } 00074 delete s; 00075 }
Here is the call graph for this function:
Socket* ServeurPrincipal::mSocketEcoute [private] |
Socket d'écoute TCP.
Definition at line 80 of file ServeurPrincipal.h.
Referenced by AttendreClient(), ServeurPrincipal(), and ~ServeurPrincipal().
TableauDyn<TraitementClient *> ServeurPrincipal::mTC [private] |
Tableau de pointeurs sur les threads traitant les clients.
Definition at line 85 of file ServeurPrincipal.h.
Referenced by AttendreClient().