sfServer Class Reference

sfServer is a high-level base class for wrapping a TCP server that handles many clients More...

#include <Server.hpp>

Inheritance diagram for sfServer:

sfThread List of all members.

Public Member Functions

virtual ~sfServer ()
 Virtual destructor.
void Start (unsigned short Port, std::size_t MaxClients=std::numeric_limits< std::size_t >::max())
 Start the server.
void Stop ()
 Stop the server (disconnects every client).
void SendTo (sfSocketTCP Client, sfPacket &Packet)
 Send a packet to a specific client.
void SendToAll (sfPacket &Packet, sfSocketTCP *Exclude=NULL)
 Send a packet to all clients (option is given to exclude one specific client).
void Disconnect (sfSocketTCP Client)
 Disconnect a client.

Detailed Description

sfServer is a high-level base class for wrapping a TCP server that handles many clients

Definition at line 44 of file Server.hpp.


Constructor & Destructor Documentation

sfServer::~sfServer (  )  [virtual]

Virtual destructor.

Definition at line 37 of file Server.cpp.


Member Function Documentation

void sfServer::Start ( unsigned short  Port,
std::size_t  MaxClients = std::numeric_limits< std::size_t >::max() 
)

Start the server.

Parameters:
Port : Port to use for listening to the incoming connections
MaxClients : Maximum number of clients allowed at the same time (no limit by default)

Definition at line 47 of file Server.cpp.

void sfServer::Stop (  ) 

Stop the server (disconnects every client).

Definition at line 66 of file Server.cpp.

void sfServer::SendTo ( sfSocketTCP  Client,
sfPacket Packet 
)

Send a packet to a specific client.

Parameters:
Client : Socket (client) to use for sending the packet
Packet : Packet to send

Definition at line 79 of file Server.cpp.

void sfServer::SendToAll ( sfPacket Packet,
sfSocketTCP Exclude = NULL 
)

Send a packet to all clients (option is given to exclude one specific client).

Parameters:
Packet : Packet to send
Exclude : Pointer to a client to exclude (NULL by default)

Definition at line 90 of file Server.cpp.

void sfServer::Disconnect ( sfSocketTCP  Client  ) 

Disconnect a client.

Parameters:
Client : Socket to disconnect

Definition at line 109 of file Server.cpp.


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