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

# ExCSocketServer Class Reference

`#include <ExCSocketServer.h>`

Inheritance diagram for ExCSocketServer:

## Public Methods
| ExCSocketServer ()
| ExCSocketServer (int domaine, int protocole)
| ~ExCSocketServer ()
int | Listen ()
void | Init (void)

## Constructor & Destructor Documentation

ExCSocketServer | ( |  | ) |

| Definition at line 8 of file ExCSocketServer.cpp. References ExCSocket::ExCSocket(), ExCSocketServer(), and Guard. Referenced by ExCSocketServer(), and ~ExCSocketServer().
    00009                                 {Guard(ExCSocketServer::ExCSocketServer())
    00010         ExCSocket();
    00011 UnGuard

ExCSocketServer | ( | int | domaine,
|  | int | protocole
| ) |

| Definition at line 13 of file ExCSocketServer.cpp. References ExCSocket::ExCSocket(), ExCSocketServer(), and Guard.
    00014                                                          {Guard(ExCSocketServer::ExCSocketServer())
    00015         ExCSocket(domaine,protocole);
    00016 UnGuard

~ExCSocketServer | ( |  | ) |

| Definition at line 18 of file ExCSocketServer.cpp. References ExCSocketServer(), Guard, and ExCSocket::m_hSocket.
    00019                                  {Guard(ExCSocketServer::~ExCSocketServer())
    00020         close(m_hSocket);
    00021 UnGuard

## Member Function Documentation

void Init | ( | void |  | ) |

| Reimplemented from ExCSocket. Definition at line 40 of file ExCSocketServer.cpp. References Guard, ExCSocket::m_AdresseIP, ExCSocket::m_AdresseSocket, ExCSocket::m_hSocket, ExCSocket::m_pInfosHost, ExCSocket::m_pIP, ExCSocket::m_Port, and Trace. Referenced by main().
    00041                               {Guard(CSocket::Init(void))
    00042
    00043         if((m_pInfosHost=gethostbyname("lore"))==0)
    00044         {
    00045                 Trace("Erreur d'aquisition sur le host");
    00046                 EXC
    00047         }
    00048         memcpy(&m_AdresseIP,m_pInfosHost->h_addr,m_pInfosHost->h_length);
    00049                 m_pIP= new char[15];
    00050         sprintf(m_pIP,"%s",inet_ntoa(m_AdresseIP));
    00051
    00052         memset(&m_AdresseSocket,0,sizeof(struct sockaddr_in));
    00053         m_AdresseSocket.sin_family= AF_INET;//le domaine
    00054         m_AdresseSocket.sin_port=htons(m_Port);
    00055         memcpy(&m_AdresseSocket.sin_addr,m_pInfosHost->h_addr,m_pInfosHost->h_length);
    00056
    00057         if(bind(m_hSocket,(struct sockaddr *)&m_AdresseSocket,sizeof(struct sockaddr_in))==-1)
    00058         {
    00059                 Trace(Erreur sur le bind su socket)
    00060                 EXC
    00061         }
    00062         if(listen(m_hSocket,SOMAXCONN)==-1)
    00063         {
    00064                 close(m_hSocket);
    00065                 EXC
    00066         }
    00067 UnGuard

int Listen | ( |  | ) |

| Definition at line 23 of file ExCSocketServer.cpp. References Guard, Listen(), ExCSocket::m_AdresseSocket, ExCSocket::m_hSocket, and Trace. Referenced by Listen(), and main().
    00024                            {Guard(ExCSocketServer::Listen())
    00025         int hNewSocket;
    00026
    00027         unsigned int tailleSockaddr_in;
    00028
    00029         tailleSockaddr_in= sizeof(struct sockaddr_in);
    00030         hNewSocket=accept(m_hSocket,(struct sockaddr *)&m_AdresseSocket,&tailleSockaddr_in);
    00031         if(hNewSocket==-1)
    00032         {
    00033                 close(m_hSocket);
    00034                 Trace(Erreur sur le listen)
    00035                 EXC
    00036         }
    00037         return hNewSocket;
    00038 UnGuard

The documentation for this class was generated from the following files:

- ExCSocketServer.h
- ExCSocketServer.cpp