Nebula
|
#include <stdtcpserver.h>
A TcpServer opens a socket and listens for connecting TcpClients.
This listen process happens in its own listener-thread and thus doesn't block the application. Each connected client is represented through a TcpClientConnection object which can be used by the application to communicate with a specific client.
Inherits Core::RefCounted.
Classes | |
class | ListenerThread |
a private listener thread class More... | |
Public Member Functions | |
StdTcpServer () | |
constructor | |
virtual | ~StdTcpServer () |
destructor | |
void | SetAddress (const IpAddress &addr) |
set address, hostname can be "any", "self" or "inetself" | |
const IpAddress & | GetAddress () const |
get address | |
void | SetClientConnectionClass (const Core::Rtti &type) |
set client connection class | |
const Core::Rtti & | GetClientConnectionClass () |
get client connection class | |
bool | Open () |
open the server | |
void | Close () |
close the server | |
bool | IsOpen () const |
return true if server is open | |
Util::Array< Ptr< TcpClientConnection > > | Recv () |
poll clients connections for received data, call this frequently! | |
bool | Broadcast (const Ptr< IO::Stream > &msg) |
broadcast a message to all clients | |
Public Member Functions inherited from Core::RefCounted | |
RefCounted () | |
constructor | |
int | GetRefCount () const |
get the current refcount | |
void | AddRef () |
increment refcount by one | |
void | Release () |
decrement refcount and destroy object if refcount is zero | |
bool | IsInstanceOf (const Rtti &rtti) const |
return true if this object is instance of given class | |
bool | IsInstanceOf (const Util::String &className) const |
return true if this object is instance of given class by string | |
bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
return true if this object is instance of given class by fourcc | |
bool | IsA (const Rtti &rtti) const |
return true if this object is instance of given class, or a derived class | |
bool | IsA (const Util::String &rttiName) const |
return true if this object is instance of given class, or a derived class, by string | |
bool | IsA (const Util::FourCC &rttiFourCC) const |
return true if this object is instance of given class, or a derived class, by fourcc | |
const Util::String & | GetClassName () const |
get the class name | |
Util::FourCC | GetClassFourCC () const |
get the class FourCC code | |
Private Member Functions | |
__DeclareClass (StdTcpServer) | |
void | AddClientConnection (const Ptr< TcpClientConnection > &connection) |
add a client connection (called by the listener thread) | |
Private Attributes | |
IpAddress | ipAddress |
Ptr< ListenerThread > | listenerThread |
bool | isOpen |
Util::Array< Ptr< TcpClientConnection > > | clientConnections |
Threading::CriticalSection | connectionCritSect |
const Core::Rtti * | connectionClassRtti |
Friends | |
class | ListenerThread |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::RefCounted | |
static void | DumpRefCountingLeaks () |
dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions inherited from Core::RefCounted | |
virtual | ~RefCounted () |
destructor (called when refcount reaches zero) | |
Net::StdTcpServer::StdTcpServer | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
private |
add a client connection (called by the listener thread)
bool Net::StdTcpServer::Broadcast | ( | const Ptr< IO::Stream > & | msg | ) |
broadcast a message to all clients
void Net::StdTcpServer::Close | ( | ) |
close the server
|
inline |
get address
|
inline |
get client connection class
|
inline |
return true if server is open
bool Net::StdTcpServer::Open | ( | ) |
open the server
Array< Ptr< TcpClientConnection > > Net::StdTcpServer::Recv | ( | ) |
poll clients connections for received data, call this frequently!
|
inline |
set address, hostname can be "any", "self" or "inetself"
|
inline |
set client connection class
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |