当前位置:网站首页>108. simple chat room 11: realize client group chat
108. simple chat room 11: realize client group chat
2022-06-26 16:34:00 【Jasonakeke】
List of articles
Title Description
Topic realization : Different clients need to communicate , One client communicates with multiple other clients , Realize group chat function .
Implement one client to communicate with multiple other clients , Run the program , After the server starts , start-up 3 A client program , Then send information to the other two clients through the first client , Then the other two clients will receive the information sent by the server .
Their thinking
Create a service class :ClientOneToManyServerFrame, Inherit JFrame class
Define a createSocket() Method , Used to create a service Socket And listening to clients . And create and start the thread object and forward the received information sent by the client to other clients .
Create a client class :ClientOneToManyClientFrame, Inherit JFrame class
Define a createClientSocket() Method , Used to create a connection to the server Socket object , Output stream object , And the start thread object receives the information forwarded by the server .
Technical focus :
The server listens to the information sent by the client through the thread , When a client sends information , This information will be sent to other clients that have logged in to the server , But this message will not be sent to the sender , The client also listens to the information forwarded by the server through threads .
(1) Create a thread class on the server side S
边栏推荐
- MS|谢黎炜组发现混合益生菌制剂及其代谢产物可缓解结肠炎
- MHA switching (recommended operation process)
- Cloud platform monitoring system based on stm32+ Huawei cloud IOT design
- day10每日3题(3):数组中的字符串匹配
- mha 切换(操作流程建议)
- 知道这几个命令让你掌握Shell自带工具
- Least squares system identification class II: recursive least squares
- Detailed explanation of cookies and sessions
- Arduino UNO + DS1302简单获取时间并串口打印
- Beijing University and Tencent jointly build angel4.0, and the self-developed in-depth learning framework "River map" is integrated into the ecology
猜你喜欢
1-12vmware adds SSH function
Practice of federal learning in Tencent micro vision advertising
【力扣刷题】二分查找:4. 寻找两个正序数组的中位数
心情不好,我就这样写代码
Net based on girdview control to delete and edit row data
JS教程之使用 ElectronJS、VueJS、SQLite 和 Sequelize ORM 从 A 到 Z 创建多对多 CRUD 应用程序
当一个程序员一天被打扰 10 次,后果很惊人!
[机缘参悟-31]:鬼谷子-抵巇[xī]篇-危机是危险与机会并存
stm32h7b0替代h750程序导致单片机挂掉无法烧录程序问题
Scala 基礎 (二):變量和數據類型
随机推荐
Kept to implement redis autofailover (redisha)
架构实战营毕业设计
When a programmer is disturbed 10 times a day, the consequences are amazing!
Keepalived 实现 Redis AutoFailover (RedisHA)1
Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction
[Li Kou brush questions] 11 Container holding the most water //42 Rain water connection
【小5聊】毕业8年,一直在追梦的路上
100+数据科学面试问题和答案总结 - 基础知识和数据分析
[from deleting the database to running] the end of MySQL Foundation (the first step is to run.)
"C language" question set of ⑩
Redis migration (recommended operation process)
100+ data science interview questions and answers Summary - basic knowledge and data analysis
Greenplum数据库故障分析——semop(id=2000421076,num=11) failed: invalid argument
[force deduction question] two point search: 4 Find the median of two positive arrays
若依打包如何分离jar包和资源文件?
Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's Mae
Redis 迁移(操作流程建议)1
Scala 基础 (二):变量和数据类型
[Blue Bridge Cup training 100 questions] scratch distinguishing prime numbers and composite numbers Blue Bridge Cup scratch competition special prediction programming question intensive training simul
MHA switching (recommended operation process)