PixelLightAPI
.
|
Network host base class. More...
#include <Host.h>
Public Member Functions | |
PLCORE_API | Host () |
Constructor. | |
virtual PLCORE_API | ~Host () |
Destructor. | |
PLCORE_API Connection * | Connect (const String &sServerName, uint32 nPort) |
Connect to a server. | |
bool | IsListening () const |
Check if the host is currently listening for new connections. | |
PLCORE_API void | Listen (uint32 nPort) |
Start listening for new connections. | |
PLCORE_API void | ClosePort () |
Stop listening for new connections. | |
PLCORE_API void | CloseConnections () |
Close all connections. | |
void | Close () |
Close host (close all connections and stop listening for new connections) | |
uint32 | GetPort () const |
Returns the currently used port number. | |
uint32 | GetMaxConnections () const |
Returns the maximum number of allowed connections. | |
void | SetMaxConnections (uint32 nMaxConnections) |
Sets the maximum number of allowed connections. | |
const Container< Connection * > & | GetConnections () const |
Get list of active connection. | |
PLCORE_API void | RemoveInactiveConnections () |
Remove inactive connections. | |
Protected Member Functions | |
virtual PLCORE_API Connection * | CreateIncomingConnection () |
Create a new incoming connection. | |
virtual PLCORE_API Connection * | CreateOutgoingConnection () |
Create a new outgoing connection. | |
virtual PLCORE_API void | OnConnect (Connection &cConnection) |
Called when a connection is established. | |
virtual PLCORE_API void | OnDisconnect (Connection &cConnection) |
Called when a connection is closed. |
Network host base class.
PLCORE_API PLCore::Host::Host | ( | ) |
virtual PLCORE_API PLCore::Host::~Host | ( | ) | [virtual] |
Destructor.
PLCORE_API Connection* PLCore::Host::Connect | ( | const String & | sServerName, |
uint32 | nPort | ||
) |
Connect to a server.
[in] | sServerName | Server name |
[in] | nPort | Port number |
bool PLCore::Host::IsListening | ( | ) | const [inline] |
Check if the host is currently listening for new connections.
PLCORE_API void PLCore::Host::Listen | ( | uint32 | nPort | ) |
Start listening for new connections.
[in] | nPort | Port at which the host is listening |
PLCORE_API void PLCore::Host::ClosePort | ( | ) |
Stop listening for new connections.
PLCORE_API void PLCore::Host::CloseConnections | ( | ) |
Close all connections.
void PLCore::Host::Close | ( | ) | [inline] |
Close host (close all connections and stop listening for new connections)
uint32 PLCore::Host::GetPort | ( | ) | const [inline] |
Returns the currently used port number.
uint32 PLCore::Host::GetMaxConnections | ( | ) | const [inline] |
Returns the maximum number of allowed connections.
void PLCore::Host::SetMaxConnections | ( | uint32 | nMaxConnections | ) | [inline] |
Sets the maximum number of allowed connections.
[in] | nMaxConnections | Maximum number of allowed connections |
const Container< Connection * > & PLCore::Host::GetConnections | ( | ) | const [inline] |
Get list of active connection.
PLCORE_API void PLCore::Host::RemoveInactiveConnections | ( | ) |
Remove inactive connections.
virtual PLCORE_API Connection* PLCore::Host::CreateIncomingConnection | ( | ) | [protected, virtual] |
Create a new incoming connection.
Reimplemented in PLCore::HttpServer, PLCore::Client, and PLCore::Server.
virtual PLCORE_API Connection* PLCore::Host::CreateOutgoingConnection | ( | ) | [protected, virtual] |
Create a new outgoing connection.
Reimplemented in PLCore::HttpClient, PLCore::Client, and PLCore::Server.
virtual PLCORE_API void PLCore::Host::OnConnect | ( | Connection & | cConnection | ) | [protected, virtual] |
Called when a connection is established.
[in] | cConnection | The new connection |
Reimplemented in PLCore::HttpServer.
virtual PLCORE_API void PLCore::Host::OnDisconnect | ( | Connection & | cConnection | ) | [protected, virtual] |
Called when a connection is closed.
[in] | cConnection | The closed connection |
Reimplemented in PLCore::HttpClient, and PLCore::HttpServer.
|