new ObjectInputStream(socket.getInputStream());

时间:2015-12-15 00:27:59

标签: java sockets server objectinputstream

当我在另一个类中调用此构造函数时,该类' GUI冻结了,我做错了什么?它不会打印任何Excepction StackTrace ....谢谢!

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;


public class Client {
    private Socket socket;
    private ObjectInputStream input;
    private ObjectOutputStream output;
    private String username;

    public Client(Socket socket, String username) {
        this.socket = socket;
        try {
            this.input = new ObjectInputStream (socket.getInputStream());
            this.output = new ObjectOutputStream (socket.getOutputStream());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    this.username = username;
}

这不是重复的,因为另一个的答案并没有解决我的GUI阻止...

0 个答案:

没有答案