找回密码
 立即注册
Chattheclassjava | 3G/4G/5G开发 2022-09-28 101 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
官方Java开发工程师QQ群(27163376),验证请输入您的ID。一个聊天室小程序拿出来共享下哈哈哈哈客户端的实现作用1.登录服务器,如果服务器端口号和IP号输入的字符都是0则,客户端连接到默许的服务器2.输入聊天昵称3.输入-quit会自动退出聊天4.输入-getList会得到在线用户的称号5.输入-tolt;用户称号gt;lt;聊天信息gt;会把信息发送到指定的用户处,别人看不到6.输入-help会得到客户端相应操作帮助6.直接输入内容则会将内容发送到一切在线的用户处客户端的类与方法1.建立连接方法:connectServer(Stringip,intport)2.断开连接方法:disconnectServer()2.发送消息方法:sendMes(Stringmes)3.承受消息方法:getMes()4.承受一次消息:getMesOnce()5.取得用户列表:getList(Stringmes)6.测试连接方法:testConnect(Stringip,intport)7.检测用户名:checkNickName(StringnickName)8.取得帮助列表:helpList();9.各项内容的输入在main方法中进行要点注意的当地因为客户端无法认识服务器何时转发数据,所以客户端需求一向不停地监听消息,为了不影响别的的方法,如发送数据,这儿用到多线程,即为承受数据单独建立一个线程,以避免影响别的方法的正常办公。本资料共包括以下附件:
Chat1\.settings\org.eclipse.jdt.core.prefs
Chat1\bin\ChatClient.class
Chat1\bin\ChatPanel.class
Chat1\bin\ChatPanelSocket.class
Chat1\bin\ChatServer.class
Chat1\bin\MyPanel.class
Chat1\bin\pubilc.class
Chat1\src\ChatClient.java
Chat1\src\ChatPanel.java
Chat1\src\ChatPanelSocket.java
Chat1\src\ChatServer.java
Chat1\src\MyPanel.java
Chat1\src\pubilc.java
Chat1\.classpath
Chat1\.project

(Official Java development engineer QQ group (27163376), please enter your ID for verification. A chat room applet is taken out to share the realization function of the client 1. Log in to the server, if the characters entered in the server port number and IP number are both 0, the client connects to the default server 2. Enter the chat nickname 3. Enter -quit will automatically exit the chat 4. Input -getList will get the title of the online user 5. Input -tolt; user name gt; lt; chat information gt; -help will get the corresponding operation help of the client 6. Direct input will send the content to all online users. The client's class and method 1. Establish connection method: connectServer(Stringip, intport) 2. Disconnect method: disconnectServer ()2. Send message method: sendMes(Stringmes)3. Accept message method: getMes()4. Accept one message: getMesOnce()5. Get user list: getList(Stringmes)6. Test connection method: testConnect(Stringip, intport) 7. Check the username: checkNickName(StringnickName) 8. Get the help list: helpList(); 9. The input of each content should be noted in the main method because the client cannot know when the server forwards the data, so The client needs to constantly monitor messages. In order not to affect other methods, such as sending data, multi-threading is used here, that is, a separate thread is created for receiving data to avoid affecting the normal work of other methods. This document includes the following attachments:
Chat1\.settings\org.eclipse.jdt.core.prefs
Chat1\bin\ChatClient.class
Chat1\bin\ChatPanel.class
Chat1\bin\ChatPanelSocket.class
Chat1\bin\ChatServer.class
Chat1\bin\MyPanel.class
Chat1\bin\pubilc.class
Chat1\src\ChatClient.java
Chat1\src\ChatPanel.java
Chat1\src\ChatPanelSocket.java
Chat1\src\ChatServer.java
Chat1\src\MyPanel.java
Chat1\src\pubilc.java
Chat1\.classpath
Chat1\.project)

[下载]10024173098.rar




上一篇:C语言嵌入式系统编程修炼之道
下一篇:java俄L斯方块