Topic: java局域网聊天程序

  Print this page

1.java局域网聊天程序 Copy to clipboard
Posted by: lb88222
Posted on: 2009-09-03 17:58

这个是我写的代码
能够运行
不过当服务端给客户端发信息时就有错误
我检查了好久都不知道如何解决
请教老师帮我看看
应该怎么改正
谢谢

我不会一下添加2个附加Tounge
客户端代码在二楼~

server.txt (3.63k)

2.Re:java局域网聊天程序 [Re: lb88222] Copy to clipboard
Posted by: lb88222
Posted on: 2009-09-03 18:00

客户端代码~~

client.txt (3.53k)

3.Re:java局域网聊天程序 [Re: lb88222] Copy to clipboard
Posted by: lb88222
Posted on: 2009-09-03 19:11

这是效果图
只要服务端说话 就出现null
之后就不能通信了

SpxImage.bmp (1607.29k)

4.Re:java局域网聊天程序 [Re: lb88222] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2009-09-03 22:17

The client TCP socket has been closed. The following lines of code are in the wrong while loop.


socket.close();
sockOut.close();
sockIn.close();


Move them out of the while loop should fix the problem.

Thanks,
Jiafan

5.Re:java局域网聊天程序 [Re: JiafanZhou] Copy to clipboard
Posted by: lb88222
Posted on: 2009-09-04 13:12

谢谢你
每次提出问题都给出了满意的答案
我喜欢这里
版主辛苦了

不过我重新打了一遍 没有改正代码就好用了 不知道为什么 可能是哪里出现中文输入法的空格了吧?!

6.Re:java局域网聊天程序 [Re: lb88222] Copy to clipboard
Posted by: JiafanZhou
Posted on: 2009-09-04 16:27

> 不过我重新打了一遍 没有改正代码就好用了 不知道为什么 可能是哪里出现中文输入法的空格了吧?!
You can disable Chinese input when you're programming Java. Trust me, it is the last thing in the world you want to debug when finding some bugs. Smile

7.Re:java局域网聊天程序 [Re: lb88222] Copy to clipboard
Posted by: binghebook
Posted on: 2009-09-04 17:03

围观


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923