当前位置:网站首页>111.简易聊天室14:聊天室客户端
111.简易聊天室14:聊天室客户端
2022-06-29 22:34:00 【Jasonakeke】
题目描述
题目实现:实现聊天室客户端。运行程序,用户登录服务器后,可以从用户列表中选择单个用户进行聊天,也可以选择多个用户进行聊天。
解题思路
创建一个服务类:ChatClientFrame,继承JFrame类。用于进行用户登录、发送聊天信息和显示聊天信息,在该类中完成窗体界面的设计。
定义createClientSocket)方法,用于创建套接字对象、输出流对象以及启动线程对象对服务器转发的信息进行处理。
定义内部线程类ClientThread,用于对服务器端转发的信息进行处理,并显示在相应的控件中。
定义发送聊天信息的send()方法。
技术重点:
通过线程对接收到的信息进行处理,其中分为3种情况,第一种接收到的是登录用户,第二种接收到的是退出提示,第三种接收到的是消息。
代码详解
package question;
边栏推荐
- Hezhou air32f103cbt6 development board hands-on Report
- 触摸按键与按键控制对应的LED状态翻转
- 模板函数与特化函数实现高效dynamicCast
- #第三天
- Qt5.14.2 error connecting to the MySQL database of Ubuntu 20.04
- Code sharing for making and developing small programs on the dating platform
- 还天天熬夜加班做报表?其实你根本不懂如何高效做报表
- Evolution from stand-alone to distributed database storage system
- IFLYTEK AI learning machine summer new product launch AI + education depth combination to create a new height of products
- Design of Distributed Message Oriented Middleware
猜你喜欢

AI scene Storage Optimization: yunzhisheng supercomputing platform storage practice based on juicefs
![leetcode:91. Decoding method [DFS + memorization]](/img/8d/9f61961fa9cfc6809a7800913e8761.png)
leetcode:91. Decoding method [DFS + memorization]

Code sharing for making and developing small programs on the dating platform

VS2013如何让编写的程序在其它电脑上面也能运行
![The server quickly sets up the alist integrated network disk website [pagoda panel one click deployment of alist]](/img/96/3e634c173c96082881286ba402a067.png)
The server quickly sets up the alist integrated network disk website [pagoda panel one click deployment of alist]

2022 (第五届)GIS软件技术大会开幕,GIS、IT将加速融合
Evolution from stand-alone to distributed database storage system

触摸按键与按键控制对应的LED状态翻转

2022年第一季度保险服务数字化跟踪分析

中国数据库崛起,阿里云李飞飞:中国云数据库多种主流技术创新已领先国外
随机推荐
What if MySQL fails to store emoticons
Cloud native enthusiast weekly: cool collection of grafana monitoring panels
Low code, end-to-end, one hour to build IOT sample scenarios, and the sound network released lingfalcon Internet of things cloud platform
GWD: rotating target detection based on Gaussian Wasserstein distance | ICML 2021
R & D test time ratio, bug data analysis
Live broadcast platform development, enter the visual area to execute animation, dynamic effects and add style class names
中国数据库崛起,阿里云李飞飞:中国云数据库多种主流技术创新已领先国外
Gnawing down the big bone - sorting (I)
地方/园区如何做好产业分析?
Number theory - division and blocking
IFLYTEK AI learning machine summer new product launch AI + education depth combination to create a new height of products
error: C2665: “QMessageBox::critical”: 4 个重载中没有一个可以转换所有参数类型
Error: c2665: "qmessagebox:: critical": none of the four overloads can convert all parameter types
5 - 1 Analyse de vulnérabilité du système
联通入库|需要各地联通公司销售其产品的都需要先入总库
云原生爱好者周刊:炫酷的 Grafana 监控面板集合
读书郎上市背后隐忧:业绩下滑明显,市场地位较靠后,竞争力存疑
An in-depth analysis of the election mechanism in kubernetes
Is it safe to open an account on the flush? Where to apply for opening an account
2022 (第五届)GIS软件技术大会开幕,GIS、IT将加速融合