QTcpServer *server;
QList<QTcpSockets*> sockets;
voidstart_server(); // Start when a new chat is onvoidclose_server(); // Close the server when the chat is overvoidsend_message(); // Send messages to clientsvoidslot_newConnection(); // When new client connects the server, newConnection() signalvoidslot_disconnected(); // When a client is offline, disconnected() signalvoidslot_readyRead(); // When a client sends message, readyRead() signal
Component 2 Chat room clients
QTcpSocket *socket;
QString username;
QString password;
bool ifConnected;
voidconnectToServer(); // Connect to the servervoidsend_message(); // Send message to the server