Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExCSocketClient Class Reference

#include <ExCSocketClient.h>

Inheritance diagram for ExCSocketClient:

ExCSocket

Public Methods

 ExCSocketClient ()
 ExCSocketClient (int domaine, int protocole)
 ~ExCSocketClient ()
void Init (void)
void Init (char *NAME)
int Connect (void)
int Connect (struct sockaddr_in Adresse)
void SetSocketAdresse (struct sockaddr_in Adresse)
sockaddr_in GetSocketAdresse (void)

Constructor & Destructor Documentation

ExCSocketClient  
 

Definition at line 11 of file ExCSocketClient.cpp.

References ExCSocket::ExCSocket(), ExCSocketClient(), and Guard.

Referenced by ExCSocketClient(), and ~ExCSocketClient().

00011                                 {Guard(ExCSocketClient::ExCSocketClient())
00012         ExCSocket();
00013 UnGuard
00014 }

ExCSocketClient int    domaine,
int    protocole
 

Definition at line 16 of file ExCSocketClient.cpp.

References ExCSocket::ExCSocket(), ExCSocketClient(), and Guard.

00016                                                          {Guard(ExCSocketClient::ExCSocketClient())
00017         ExCSocket(domaine,protocole);
00018 UnGuard
00019 }

~ExCSocketClient  
 

Definition at line 21 of file ExCSocketClient.cpp.

References ExCSocketClient(), and Guard.

00021                                  {Guard(ExCSocketClient::~ExCSocketClient())
00022 
00023 UnGuard
00024 }


Member Function Documentation

int Connect struct sockaddr_in    Adresse
 

Definition at line 26 of file ExCSocketClient.cpp.

References ExCSocket::Close(), Connect(), Guard, ExCSocket::m_hSocket, and Trace.

00026                                                       {Guard(ExCSocketClient::Connect(struct sockaddr_in Adresse))
00027         int ret=0;
00028         unsigned int tailleSockaddr_in;
00029         tailleSockaddr_in=sizeof(struct sockaddr_in);
00030         if((ret==connect(m_hSocket,(struct sockaddr *)&Adresse,tailleSockaddr_in))==-1)
00031         {
00032                 Trace(Erreur sur connect de la socket);
00033                 Close();
00034         }
00035         return ret;
00036 UnGuard
00037 }

int Connect void   
 

Definition at line 38 of file ExCSocketClient.cpp.

References ExCSocket::Close(), Connect(), Guard, ExCSocket::m_AdresseSocket, ExCSocket::m_hSocket, and Trace.

Referenced by Connect().

00038                                 {Guard(ExCSocketClient::Connect())
00039         int ret=0;
00040         unsigned int tailleSockaddr_in;
00041         tailleSockaddr_in=sizeof(struct sockaddr_in);
00042         if((ret==connect(m_hSocket,(struct sockaddr *)&m_AdresseSocket,tailleSockaddr_in))==-1)
00043         {
00044                 Trace(Erreur sur connect de la socket);
00045                 Close();
00046         }
00047         return ret;
00048 UnGuard
00049 }

struct sockaddr_in GetSocketAdresse void   
 

Definition at line 56 of file ExCSocketClient.cpp.

References GetSocketAdresse(), and Guard.

Referenced by GetSocketAdresse().

00056                                                         {Guard(ExCSocketClient::GetSocketAdresse(void))
00057         return m_AdresseSocket;
00058 UnGuard
00059 }

void Init char *    NAME
 

Definition at line 80 of file ExCSocketClient.cpp.

References Guard, Init(), ExCSocket::m_AdresseIP, ExCSocket::m_AdresseSocket, ExCSocket::m_pInfosHost, ExCSocket::m_pIP, ExCSocket::m_Port, and Trace.

00080                                     {Guard(void ExCSocketClient::Init(void))
00081 
00082         if((m_pInfosHost=gethostbyname(NAME))==0)
00083         {
00084                 Trace("Erreur d'aquisition sur le host NAME");
00085         }
00086         memcpy(&m_AdresseIP,m_pInfosHost->h_addr,m_pInfosHost->h_length);
00087                 m_pIP= new char[15];
00088         sprintf(m_pIP,"%s",inet_ntoa(m_AdresseIP));
00089 
00090         memset(&m_AdresseSocket,0,sizeof(struct sockaddr_in));
00091         m_AdresseSocket.sin_family= AF_INET;//le domaine
00092         m_AdresseSocket.sin_port=htons(m_Port);
00093         memcpy(&m_AdresseSocket.sin_addr,m_pInfosHost->h_addr,m_pInfosHost->h_length);
00094         
00095 
00096 UnGuard
00097 }

void Init void   
 

Reimplemented from ExCSocket.

Definition at line 61 of file ExCSocketClient.cpp.

References Guard, Init(), ExCSocket::m_AdresseIP, ExCSocket::m_AdresseSocket, ExCSocket::m_pInfosHost, ExCSocket::m_pIP, ExCSocket::m_Port, and Trace.

Referenced by Init().

00061                               {Guard(void ExCSocketClient::Init(void))
00062 
00063         if((m_pInfosHost=gethostbyname("lore"))==0)
00064         {
00065                 Trace("Erreur d'aquisition sur le host");
00066         }
00067         memcpy(&m_AdresseIP,m_pInfosHost->h_addr,m_pInfosHost->h_length);
00068                 m_pIP= new char[15];
00069         sprintf(m_pIP,"%s",inet_ntoa(m_AdresseIP));
00070 
00071         memset(&m_AdresseSocket,0,sizeof(struct sockaddr_in));
00072         m_AdresseSocket.sin_family= AF_INET;//le domaine
00073         m_AdresseSocket.sin_port=htons(m_Port);
00074         memcpy(&m_AdresseSocket.sin_addr,m_pInfosHost->h_addr,m_pInfosHost->h_length);
00075         
00076 
00077 UnGuard
00078 }

void SetSocketAdresse struct sockaddr_in    Adresse
 


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:28 2002 for ExNihilo by doxygen1.3-rc1