sfServer Class Reference

#include <Server.hpp>

List of all members.

Public Member Functions

virtual ~sfServer ()
void Start (unsigned int Port, std::size_t MaxClients=std::numeric_limits< std::size_t >::max())
void Stop ()
void SendTo (sfSocketTCP Client, sfPacket &Packet)
void SendToAll (sfPacket &Packet, sfSocketTCP *Exclude=NULL)
void Disconnect (sfSocketTCP 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.

References Stop().


Member Function Documentation

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

Start the server

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

Definition at line 47 of file Server.cpp.

References Stop().

void sfServer::Stop (  ) 

Stop the server (disconnects every client)

Definition at line 66 of file Server.cpp.

Referenced by Start(), and ~sfServer().

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.

References Disconnect(), and sfSocketTCP::Send().

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.

References Disconnect().

void sfServer::Disconnect ( sfSocketTCP  Client  ) 

Disconnect a client

Parameters:
Client : Socket to disconnect

Definition at line 109 of file Server.cpp.

References sfSocketTCP::Close(), and sfSelector< SocketType >::Remove().

Referenced by SendTo(), and SendToAll().


The documentation for this class was generated from the following files:
Generated for SFML by  doxygen 1.5.2