#include <Server.hpp>
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) |
Definition at line 44 of file Server.hpp.
sfServer::~sfServer | ( | ) | [virtual] |
void sfServer::Start | ( | unsigned int | Port, | |
std::size_t | MaxClients = std::numeric_limits< std::size_t >::max() | |||
) |
Start the server
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
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)
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
Client | : Socket to disconnect |
Definition at line 109 of file Server.cpp.
References sfSocketTCP::Close(), and sfSelector< SocketType >::Remove().
Referenced by SendTo(), and SendToAll().