public class ServerThread extends Thread {
private Message client;
private Socket fromServer;
private ObjectOutputStream out;
private ObjectInputStream in;
private TextView checkText;
//конструктор для регистрации
public ServerThread(Message clientSend, TextView checkText){
this.client = clientSend;
this.checkText = checkText;
start();
}
private void check() {
Message serverSend = null;
try {
out.writeObject(client);
try {
serverSend = (Message) in.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
if(serverSend.getMessage()=="true"){
checkText.setText("Регистрация успешно завершена.");
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void run() {
try {
fromServer = new Socket("localhost", 5050);
out = new ObjectOutputStream(fromServer.getOutputStream());
in = new ObjectInputStream(fromServer.getInputStream());
if (client.getSight() == "R"){
check();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
java.net.SocketTimeoutException: failed to connect to /localhost (port 5050) after 90000ms
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:176)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:112)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.Socket.startupSocket(Socket.java:579)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.Socket.tryAllAddresses(Socket.java:131)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.Socket.(Socket.java:181)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at java.net.Socket.(Socket.java:153)
01-29 19:33:09.632 13656-13743/com.example.finalproject W/System.err: at com.example.finalproject.Other.ServerThread.run(ServerThread.java:47)
Запустил сервер на локалхосте и запускаю клиент и вот это, в чем проблема?