#include <ExCSocket.h>
Graphe d'héritage de la classe ExCSocket
Membres publics | |
ExCSocket () | |
ExCSocket (ExCSocket &socket) | |
ExCSocket (int Handler) | |
ExCSocket (int *Handler) | |
ExCSocket (int domaine, int protocole) | |
~ExCSocket () | |
void | Init (void) |
void | Close (void) |
int | GetHandler (void) |
void | SetHandler (int handler) |
std::string | GetIp (void) |
void | SetIp (std::string ip) |
int | GetSocketPort (void) |
void | SetSocketPort (int port) |
void | SendMessage (ExCMessage &OutMessage) |
void | RecvMessage (ExCMessage &InMessage) |
Attributs Publics | |
int | m_Port |
std::string | m_pIP |
int | m_hSocket |
hostent * | m_pInfosHost |
in_addr | m_AdresseIP |
sockaddr_in | m_AdresseSocket |
|
Définition à la ligne 9 du fichier ExCSocket.cpp. Références ExCSocket(), Guard, m_hSocket, SetSocketPort(), et UnGuard. Référencé par ExCSocket(), ExCSocketClient::ExCSocketClient(), ExCSocketServer::ExCSocketServer(), et ~ExCSocket().
00009 {Guard(ExCSocket::ExCSocket()) 00010 #if _WIN32 00011 WSADATA WSAData; 00012 WSAStartup(MAKEWORD(2,0), &WSAData); 00013 #endif 00014 SetSocketPort(5000); 00015 m_hSocket=socket(AF_INET,SOCK_STREAM,0); 00016 if(m_hSocket==-1) 00017 { 00018 std::cout<<"Socket error"<<std::endl; 00019 } 00020 UnGuard 00021 } |
|
Définition à la ligne 37 du fichier ExCSocket.cpp. Références ExCSocket(), GetHandler(), GetIp(), GetSocketPort(), Guard, SetHandler(), SetIp(), SetSocketPort(), et UnGuard.
00038 { 00039 Guard(ExCSocket::ExCSocket(ExCSocket& socket)) 00040 SetSocketPort(socket.GetSocketPort()); 00041 SetHandler(socket.GetHandler()); 00042 SetIp(socket.GetIp()); 00043 UnGuard 00044 } |
|
Définition à la ligne 23 du fichier ExCSocket.cpp. Références ExCSocket(), Guard, SetHandler(), et UnGuard.
00024 { 00025 Guard(ExCSocket::ExCSocket(int handler)) 00026 SetHandler(Handler); 00027 UnGuard 00028 } |
|
Définition à la ligne 30 du fichier ExCSocket.cpp. Références ExCSocket(), Guard, SetHandler(), et UnGuard.
00031 { 00032 Guard(ExCSocket::ExCSocket(int handler)) 00033 SetHandler(*Handler); 00034 UnGuard 00035 } |
|
Définition à la ligne 46 du fichier ExCSocket.cpp. Références ExCSocket(), Guard, m_hSocket, et UnGuard.
|
|
Définition à la ligne 57 du fichier ExCSocket.cpp. Références Close(), ExCSocket(), Guard, et UnGuard.
|
|
Définition à la ligne 92 du fichier ExCSocket.cpp. Références Close(), Guard, m_hSocket, et UnGuard. Référencé par Close(), ExManagerNetwork::Connect(), ExCSocketClient::Connect(), ExManagerNetwork::Disconnect(), ExCSocketServer::Listen(), ~ExCSocket(), et ExCSocketServer::~ExCSocketServer().
|
|
Définition à la ligne 99 du fichier ExCSocket.h. Références m_hSocket. Référencé par ExCSocket().
00099 {return m_hSocket;} |
|
Définition à la ligne 101 du fichier ExCSocket.h. Références m_pIP. Référencé par ExCSocket().
00101 {return m_pIP;} |
|
Définition à la ligne 103 du fichier ExCSocket.h. Références m_Port. Référencé par ExCSocket().
00103 {return m_Port;} |
|
Redéfinie dans ExCSocketClient, et ExCSocketServer. Définition à la ligne 68 du fichier ExCSocket.cpp. Références EXC, Guard, Init(), m_AdresseIP, m_AdresseSocket, m_pInfosHost, m_Port, SetIp(), Trace, et UnGuard. Référencé par ExCSocketServer::Init(), ExCSocketClient::Init(), et Init().
00069 { 00070 Guard(ExCSocket::Init(void)) 00071 #if _WIN32 00072 //m_AdresseSocket.sin_addr.s_addr = inet_addr("192.168.0.1"); 00073 m_AdresseSocket.sin_addr.s_addr = inet_addr("80.200.104.109"); 00074 #else 00075 //if((m_pInfosHost=gethostbyname("lore.starfleet.org"))==0) 00076 if((m_pInfosHost=gethostbyname("hobbes.homelinux.net"))==0) 00077 { 00078 Trace("Erreur d'aquisition sur le host"); 00079 EXC 00080 } 00081 memcpy(&m_AdresseIP,m_pInfosHost->h_addr,m_pInfosHost->h_length); 00082 SetIp(inet_ntoa(m_AdresseIP)); 00083 memset(&m_AdresseSocket,0,sizeof(struct sockaddr_in)); 00084 memcpy(&m_AdresseSocket.sin_addr,m_pInfosHost->h_addr,m_pInfosHost->h_length); 00085 #endif 00086 m_AdresseSocket.sin_family= AF_INET;//le domaine 00087 m_AdresseSocket.sin_port=htons(m_Port); 00088 UnGuard 00089 } |
|
Définition à la ligne 111 du fichier ExCSocket.cpp. Références Guard, m_hSocket, RecvMessage(), ExCMessage::SetMessage(), ExCMessage::SetType(), Trace, et UnGuard. Référencé par ExManagerNetwork::Connect(), ExManagerNetwork::Ping(), et RecvMessage().
00112 { 00113 Guard(void ExCSocket::RecvMessage(ExCMessage InMessage)) 00114 00115 char * buffer; 00116 buffer = new char[500]; 00117 if(recv(m_hSocket,buffer,500,0)==-1) 00118 { 00119 Trace(Error on Recv Message) 00120 } 00121 //extract type 00122 std::string bufftype; 00123 for(unsigned int i=0;i<4;i++) 00124 { 00125 bufftype=bufftype+buffer[i]; 00126 } 00127 InMessage.SetType(atoi(bufftype.data())); 00128 //extract msg 00129 std::string bufferMsg; 00130 for(unsigned int j=5;j<500;j++) 00131 { 00132 bufferMsg=bufferMsg+buffer[j]; 00133 if(strcmp("\0",&buffer[j])==0)break; 00134 } 00135 InMessage.SetMessage(bufferMsg); 00136 UnGuard 00137 } |
|
Définition à la ligne 102 du fichier ExCSocket.cpp. Références ExCMessage::GetMessage(), ExCMessage::GetType(), Guard, m_hSocket, SendMessage(), Trace, et UnGuard. Référencé par ExManagerNetwork::Connect(), ExManagerNetwork::Disconnect(), ExManagerNetwork::InputCommand(), ExManagerNetwork::Ping(), et SendMessage().
00102 {Guard(void ExCSocket::SendMessage(ExCMessage OutMessage)) 00103 char *buffer; 00104 buffer= new char[500]; 00105 sprintf(buffer,"%d#%s%s",OutMessage.GetType(),OutMessage.GetMessage().data(),"\0"); 00106 if(send(m_hSocket,buffer,500,0)==-1) 00107 {Trace(Error on send Message)} 00108 UnGuard 00109 } |
|
Définition à la ligne 100 du fichier ExCSocket.h. Références m_hSocket. Référencé par ExCSocket().
00100 {m_hSocket=handler;} |
|
Définition à la ligne 102 du fichier ExCSocket.h. Références m_pIP. Référencé par ExCSocket(), et Init().
00102 {m_pIP=ip;} |
|
Définition à la ligne 104 du fichier ExCSocket.h. Références m_Port. Référencé par ExCSocket().
00104 {m_Port=port;} |
|
Définition à la ligne 82 du fichier ExCSocket.h. Référencé par Init(). |
|
Définition à la ligne 83 du fichier ExCSocket.h. Référencé par ExCSocketClient::Connect(), ExCSocketServer::Init(), Init(), et ExCSocketServer::Listen(). |
|
Définition à la ligne 80 du fichier ExCSocket.h. Référencé par Close(), ExCSocketClient::Connect(), ExCSocket(), GetHandler(), ExCSocketServer::Init(), ExCSocketServer::Listen(), RecvMessage(), SendMessage(), et SetHandler(). |
|
Définition à la ligne 81 du fichier ExCSocket.h. Référencé par Init(). |
|
Définition à la ligne 79 du fichier ExCSocket.h. |
|
Définition à la ligne 78 du fichier ExCSocket.h. Référencé par GetSocketPort(), Init(), et SetSocketPort(). |