libkdegames/libkdegamesprivate/kgame
kmessageserver.cpp
Go to the documentation of this file.
244 QDataStream (&msg, QIODevice::WriteOnly) << quint32 (EVNT_CLIENT_DISCONNECTED) << client->id() << (qint8)broken;
296 for (QList<KMessageIO*>::iterator iter(d->mClientList.begin()); iter!=d->mClientList.end(); ++iter)
354 for (QList<KMessageIO*>::iterator iter (d->mClientList.begin()); iter!=d->mClientList.end(); ++iter)
quint32 uniqueClientNumber() const
Definition: kmessageserver.cpp:345
Definition: kmessageserver.h:185
Definition: kmessageserver.h:201
KMessageIO * findClient(quint32 no) const
Find the KMessageIO object to the given client number.
Definition: kmessageserver.cpp:301
This class implements the message communication using a TCP/IP socket.
Definition: kmessageio.h:170
QObject * sender() const
void newConnection()
quint32 adminID() const
Returns the clientID of the admin, if there is a admin, 0 otherwise.
Definition: kmessageserver.cpp:316
void removeClient(KMessageIO *io, bool broken)
Removes the KMessageIO object from the client list and deletes it.
Definition: kmessageserver.cpp:233
virtual void sendMessage(quint32 id, const QByteArray &msg)
Sends a message to a single client with the given ID.
Definition: kmessageserver.cpp:358
quint16 serverPort() const
Returns the TCP/IP port number we are listening to for incoming connections.
Definition: kmessageserver.cpp:156
int clientCount() const
returns the current number of connected clients.
Definition: kmessageserver.cpp:288
QByteArray & buffer()
virtual bool hasPendingConnections() const
void setAdmin(quint32 adminID)
Sets the admin to a new client with the given ID.
Definition: kmessageserver.cpp:321
void addClient(KMessageIO *)
Adds a new KMessageIO object to the communication server.
Definition: kmessageserver.cpp:180
void messageReceived(const QByteArray &data, quint32 clientID, bool &unknown)
This signal is always emitted when a message from a client is received.
void clientConnected(KMessageIO *client)
A new client connected to the game.
virtual bool atEnd() const
void append(const T &value)
QList< quint32 > clientIDs() const
returns a list of the unique IDs of all clients.
Definition: kmessageserver.cpp:293
Definition: kmessageserver.h:199
Definition: kmessageserver.h:187
bool listen(const QHostAddress &address, quint16 port)
KMessageServerSocket(quint16 port, QObject *parent=0)
Definition: kmessageserver.cpp:36
This abstract base class represents one end of a message connections between two clients.
Definition: kmessageio.h:57
QByteArray readAll()
virtual bool open(QFlags< QIODevice::OpenModeFlag > flags)
iterator end()
virtual void getReceivedMessage(const QByteArray &msg)
This slot receives all the messages from the KMessageIO::received signals.
Definition: kmessageserver.cpp:371
virtual QTcpSocket * nextPendingConnection()
virtual void broadcastMessage(const QByteArray &msg)
Sends a message to all connected clients.
Definition: kmessageserver.cpp:352
virtual void processOneMessage()
This slot is called whenever there are elements in the message queue.
Definition: kmessageserver.cpp:392
bool initNetwork(quint16 port=0)
Starts the Communication server to listen for incoming TCP/IP connections.
Definition: kmessageserver.cpp:127
KMessageServer(quint16 cookie=42, QObject *parent=0)
Create a KGameNetwork object.
Definition: kmessageserver.cpp:99
bool isOfferingConnections() const
Are we still offer offering server connections?
Definition: kmessageserver.cpp:173
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual void send(const QByteArray &msg)=0
This slot sends the data block in /e msg to the connected object, that will emit /e received()...
void newClientConnected(KMessageIO *client)
iterator begin()
void connectionLost(KMessageIO *client)
A network connection got broken.
void setMaxClients(int maxnumber)
sets the maximum number of clients which can connect.
Definition: kmessageserver.cpp:278
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.