网络通信安全与聊天应用实现
1. 聊天客户端的实现与构建
1.1 消息处理与定时器
在聊天客户端中,当处理完所有待处理的消息后,会重新启动定时器。代码如下:
str = cmd.op1 + " has left the room.\n";
chatEdit->append(str.c_str());
}
}
}
After we process all of the pending messages, we start the timer again.
theTimer->start(250, true);
1.2 Makefile构建
使用Makefile来构建聊天客户端,需要进行一些额外的步骤来预处理窗口类,以便构建事件处理机制。以下是Makefile的内容:
CC = g++
INCDIR = -I $(QTDIR)/include
LDFLAGS = -L $(QTDIR)/lib -lqt-mt
all: chatcli
chatcli: chatcli.o chatwin.o logindlg.o
moc_chatwin.o moc_logindlg.o
$(CC) -o chatcli $(LDFLAGS) chatcli.o chatwin.o logindlg.o moc_chatwin.o \
moc_logindlg.o
chatcli.o: chatcli.cpp
$(CC) -c $(INCDIR) chatcli.cpp
chatwin
超级会员免费看
订阅专栏 解锁全文
3257

被折叠的 条评论
为什么被折叠?



