19 #ifndef __CONNECTION_H__ 20 #define __CONNECTION_H__ 22 #include <csutil/threading/thread.h> 26 struct iObjectRegistry;
73 virtual void Multicast (
MsgEntry* me,
const csArray<PublishDestination>& multi, uint32_t except,
float range);
120 csRef<CS::Threading::Thread> thread;
bool Initialize(iObjectRegistry *object_reg)
Just some basic initialization for the class.
This class holds data for a connection.
void DisConnect()
Kills the thread and closes the socket.
MsgQueue * inQueue
This is the inbound queue to the client.
bool shouldRun
When this is false, thread will finish it's last loop and exit.
virtual void IncRef()
Necessary CS definition and stub function.
The structure of 1 queue entry (pointer to a message)
virtual void DecRef()
Necessary CS definition and stub function.
iObjectRegistry * object_reg
virtual Connection * GetConnByNum(uint32_t clientnum)
Returns the server connection if the clientnum is 0.
virtual void Multicast(MsgEntry *me, const csArray< PublishDestination > &multi, uint32_t except, float range)
Multicasting makes no sense in a single connection class. Just wraps SendMessage. ...
virtual ~psNetConnection()
Disconnects and terminates the thread.
void Run()
this is the main thread function...
This class acts as a base for client/server net classes.
A queue of smart pointers with locking facilties for multi-threading.
Connection * server
Connection class holds the IP address and port we are using here.
psNetConnection(int queueLength=100)
Creates a queue of messages queueLength wide.
virtual int GetRefCount()
bool Connect(const char *server, int port)
Connects to the server and starts the thread to poll it.
virtual Connection * GetConnByIP(LPSOCKADDR_IN addr)
Returns the same address back if the address is correct. NULL if not.
virtual bool HandleUnknownClient(LPSOCKADDR_IN addr, MsgEntry *data)
Another overridden function only used by multi-connection class NetManager.
void CheckLinkDead(csTicks time)
This checks the time since the last packet received from the server.
virtual void Broadcast(MsgEntry *me, int scope, int guildID)
Broadcasting makes no sense in a single connection class. Just wraps SendMessage. ...