文件名称:局域网聊天
文件大小:4KB
文件格式:JAVA
更新时间:2016-12-11 06:21:19
Socket编程
一个简单的局域网聊天代码 socket = new Socket(ip, 8888); writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),"gbk")); reader = new BufferedReader(new InputStreamReader( socket.getInputStream(),"gbk")); Message msg=new Message(); msg.obj="连接成功!\n"; msg.what=0x123; handler.sendMessage(msg);