当前位置:网站首页>108. 简易聊天室11:实现客户端群聊
108. 简易聊天室11:实现客户端群聊
2022-06-26 16:30:00 【Jasonakeke】
题目描述
题目实现:不同的客户端之间需要进行通信,一个客户端与其他的多个客户端进行通信,实现群聊功能。
实现一个客户端与其他多个客户端进行通信,运行程序,服务器启动后,启动3个客户端程序,然后通过第一个客户端向另外两个客户端发送信息,则另外的两个客户端都会收到服务器发送的信息。
解题思路
创建一个服务类:ClientOneToManyServerFrame,继承JFrame类
定义一个createSocket()方法,用于创建服务Socket和监听客户端程序。以及创建并启动线程对象并将接收到的客户端发送的信息转发给其他客户端。
创建一个客户端类:ClientOneToManyClientFrame,继承JFrame类
定义一个createClientSocket()方法,用于创建与服务器连接的Socket对象,输出流对象,以及启动线程对象接收服务器端转发的信息。
技术重点:
在服务器端通过线程对客户端发送的信息进行监听,当有客户端发送信息时,就会将该信息发送给其他已经登录到服务器的客户端,但是不会向发送方发送该信息,在客户端也通过线程来监听服务器转发的信息。
(1)在服务器端创建线程类S
边栏推荐
- 理想路径问题
- 10 tf. data
- 【力扣刷题】二分查找:4. 寻找两个正序数组的中位数
- The details of the first pig heart transplantation were fully disclosed: human herpes virus was found in the patient, the weight of the heart doubled after death, and myocardial cell fibrosis
- 若依如何实现接口限流?
- Natural language inference with attention and fine tuning Bert pytorch
- JS tutorial - printing stickers / labels using the electronjs desktop application
- (1) Keras handwritten numeral recognition and recognition of self written numbers
- Redis Guide (8): principle and implementation of Qianfan Jingfa distributed lock
- IAR engineering adapts gd32 chip
猜你喜欢

【力扣刷题】二分查找:4. 寻找两个正序数组的中位数
Redis Guide (8): principle and implementation of Qianfan Jingfa distributed lock

我把它当副业月入3万多,新手月入过万的干货分享!

Learn about common functional interfaces
![[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)](/img/75/2fb1a4e6215e404df34849e9e4f21a.png)
[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)

基于Kubebuilder开发Operator(入门使用)

Angel 3.2.0 new version released! Figure the computing power is strengthened again

Net基于girdview控件实现删除与编辑行数据

Ideal path problem

了解下常见的函数式接口
随机推荐
Tencent Peking University's sparse large model training acceleration program het was selected into the VLDB of the international summit
The first batch in the industry! Tencent cloud security and privacy computing products based on angel powerfl passed CFCA evaluation
Développer un opérateur basé sur kubebuilder (démarrer)
[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
Redis migration (recommended operation process)
Solution for filtering by special string of microservice
Practice of federal learning in Tencent micro vision advertising
长安链交易防重之布谷鸟过滤器
Net基于girdview控件实现删除与编辑行数据
清华“神奇药水”登Nature:逆转干细胞分化,比诺奖成果更进一步,网友:不靠精子卵子就能创造生命了?!...
I regard it as a dry product with a monthly income of more than 30000 yuan for sidelines and more than 10000 yuan for novices!
day10每日3题(1):逐步求和得到正数的最小值
Solidus Labs欢迎香港前金融创新主管赵嘉丽担任战略顾问
Keepalived 实现 Redis AutoFailover (RedisHA)
Exquisite makeup has become the "soft power" of camping, and the sales of vipshop outdoor beauty and skin care products have surged
Kept to implement redis autofailover (redisha) 1
R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over discrete, and use the ratio of residual deviation and residual degr
神经网络“炼丹炉”内部构造长啥样?牛津大学博士小姐姐用论文解读
Structure the graduation project of actual combat camp
牛客编程题--必刷101之动态规划(一文彻底了解动态规划)