资源简介

采用TCP协议开发的,swing做界面的java socket聊天室 支持群聊和私聊,发文件,以及用户登录注册等

资源截图

代码片段和文件信息


import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

public class CT {

    public static void main(String[] args) {
        int length = 0;
        byte[] sendBytes = null;
        Socket socket = null;
        DataOutputStream dos = null;
        FileInputStream fis = null;

        try {
            try {
                socket = new Socket();
                socket.connect(new InetSocketAddress(“127.0.0.1“ 33456)
                        10 * 1000);
                dos = new DataOutputStream(socket.getOutputStream());
                File file = new File(“C:\\Users\\Administrator.LS--20170308ZNP\\Desktop\\新建文件夹\\深入浅出Java_Swing程序设计.pdf“);
                fis = new FileInputStream(file);
                sendBytes = new byte[1024];
                while ((length = fis.read(sendBytes 0 sendBytes.length)) > 0) {
                    dos.write(sendBytes 0 length);
                    dos.flush();
                }
            } finally {
                if (dos != null) {
                    dos.close();
                }
                if (fis != null) {
                    fis.close();
                }
                if (socket != null) {
                    socket.close();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         99  2017-05-22 10:36  Server\build\built-jar.properties

     文件       3230  2017-05-22 10:36  Server\build\classes\cn\scau\dao\UserDao.class

     文件        809  2017-05-22 10:36  Server\build\classes\cn\scau\exception\UserException.class

     文件       1092  2017-05-22 10:36  Server\build\classes\cn\scau\model\BagTarget.class

     文件        972  2017-05-22 10:36  Server\build\classes\cn\scau\model\ChatData.class

     文件       1949  2017-05-22 10:36  Server\build\classes\cn\scau\model\DataBag.class

     文件        821  2017-05-22 10:36  Server\build\classes\cn\scau\model\Emot.class

     文件       2953  2017-05-22 10:36  Server\build\classes\cn\scau\model\FileClientThread.class

     文件       2045  2017-05-22 10:36  Server\build\classes\cn\scau\model\User.class

     文件       4543  2017-05-22 10:36  Server\build\classes\cn\scau\server\LoginChk.class

     文件        659  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$1.class

     文件        742  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$2.class

     文件       3124  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$3$1.class

     文件        933  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$3$2.class

     文件       1812  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$3.class

     文件       2461  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$4.class

     文件       1021  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$5.class

     文件       2493  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$6.class

     文件       4744  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$ClientThread.class

     文件       3087  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server$ServerThread.class

     文件      14590  2017-05-22 10:36  Server\build\classes\cn\scau\server\Server.class

     文件       1290  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\ImagePanel.class

     文件        918  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\loginPane.class

     文件        773  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\loginUI$1.class

     文件       3862  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\loginUI.class

     文件        844  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\PrivateChatUI$1.class

     文件       3232  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\PrivateChatUI.class

     文件       2033  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\ServerList.class

     文件        752  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\ServerUi$1.class

     文件       5558  2017-05-22 10:36  Server\build\classes\cn\scau\serverUI\ServerUi.class

............此处省略239个文件信息

评论

共有 条评论