Nebula
Loading...
Searching...
No Matches
stdtcpserver.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
16#include "core/refcounted.h"
17#include "threading/thread.h"
18#include "util/array.h"
20#include "net/socket/socket.h"
22
23//------------------------------------------------------------------------------
24namespace Net
25{
87
88//------------------------------------------------------------------------------
91inline bool
93{
94 return this->isOpen;
95}
96
97//------------------------------------------------------------------------------
100inline void
102{
103 this->ipAddress = addr;
104}
105
106//------------------------------------------------------------------------------
109inline const IpAddress&
111{
112 return this->ipAddress;
113}
114
115//------------------------------------------------------------------------------
118inline void
123
124//------------------------------------------------------------------------------
127inline const Core::Rtti&
132} // namespace Net
133//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
Nebula's runtime type information for one class.
Definition rtti.h:27
Represents an IP address, consisting of a IPv4 host address and a port number.
a private listener thread class
Definition stdtcpserver.h:56
virtual void DoWork()
implements the actual listener method
Definition stdtcpserver.cc:202
void SetAddress(const IpAddress &a)
set ip address
Definition stdtcpserver.cc:180
const Core::Rtti * connectionClassRtti
Definition stdtcpserver.h:74
Ptr< Socket > socket
Definition stdtcpserver.h:73
void SetClientConnectionClass(const Core::Rtti &type)
set client connection class
Definition stdtcpserver.cc:189
Ptr< StdTcpServer > tcpServer
Definition stdtcpserver.h:71
void SetTcpServer(StdTcpServer *tcpServer)
set pointer to parent tcp server
Definition stdtcpserver.cc:170
IpAddress ipAddress
Definition stdtcpserver.h:72
virtual void EmitWakeupSignal()
send a wakeup signal
Definition stdtcpserver.cc:247
A TcpServer opens a socket and listens for connecting TcpClients.
Definition stdtcpserver.h:27
virtual ~StdTcpServer()
destructor
Definition stdtcpserver.cc:30
bool Broadcast(const Ptr< IO::Stream > &msg)
broadcast a message to all clients
Definition stdtcpserver.cc:150
Util::Array< Ptr< TcpClientConnection > > Recv()
poll clients connections for received data, call this frequently!
Definition stdtcpserver.cc:101
const IpAddress & GetAddress() const
get address
Definition stdtcpserver.h:110
const Core::Rtti & GetClientConnectionClass()
get client connection class
Definition stdtcpserver.h:128
IpAddress ipAddress
Definition stdtcpserver.h:80
void SetAddress(const IpAddress &addr)
set address, hostname can be "any", "self" or "inetself"
Definition stdtcpserver.h:101
const Core::Rtti * connectionClassRtti
Definition stdtcpserver.h:85
void AddClientConnection(const Ptr< TcpClientConnection > &connection)
add a client connection (called by the listener thread)
Definition stdtcpserver.cc:89
__DeclareClass(StdTcpServer)
Util::Array< Ptr< TcpClientConnection > > clientConnections
Definition stdtcpserver.h:83
Threading::CriticalSection connectionCritSect
Definition stdtcpserver.h:84
bool isOpen
Definition stdtcpserver.h:82
void SetClientConnectionClass(const Core::Rtti &type)
set client connection class
Definition stdtcpserver.h:119
void Close()
close the server
Definition stdtcpserver.cc:62
StdTcpServer()
constructor
Definition stdtcpserver.cc:21
Ptr< ListenerThread > listenerThread
Definition stdtcpserver.h:81
bool Open()
open the server
Definition stdtcpserver.cc:39
bool IsOpen() const
return true if server is open
Definition stdtcpserver.h:92
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Definition debugmessage.h:20