00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Pierre Schmitt, Ludovic Giacomello, Nhi Ly * 00003 * * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 00022 #ifndef CLIENTSP_H 00023 #define CLIENTSP_H 00024 00025 #include <iostream> 00026 #include <cstdlib> 00027 #include <fstream> 00028 #include <sstream> 00029 #include <string> 00030 00031 #include "SocketTCP.h" 00032 00033 using namespace std; 00034 00038 class ClientSP{ 00039 public: 00048 ClientSP(string adresse, unsigned int port,string login="", string mdp=""); 00049 ~ClientSP(); 00050 00055 bool EstPret() {return mPortRenseigne;} 00056 00061 unsigned int GetPort() {return mPort;} 00062 00067 string GetLogin() {return mLogin;} 00068 private: 00074 void Traitement(string login, string mdp); 00075 void SendHello(); 00076 void SendLogin(string login, string mdp); 00077 void RegLogin(string login, string mdp); 00078 unsigned int ListerPartie(); 00079 void ListerScore(); 00080 void ChoisirPartie(); 00081 int CreationPartie(); 00082 int RejoindrePartie(string port); 00083 00087 Socket *mSocket; 00088 00092 bool mPortRenseigne; 00093 00097 unsigned int mPort; 00098 00102 string mLogin; 00103 }; 00104 #endif