Fixed wrong exception catching
This commit is contained in:
parent
1ac0d97ce7
commit
f296770a21
@ -8,6 +8,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.net.ConnectException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
@ -43,7 +44,7 @@ public class Connection {
|
|||||||
public Connection(String address) throws IOException {
|
public Connection(String address) throws IOException {
|
||||||
try {
|
try {
|
||||||
connectAsClient(address);
|
connectAsClient(address);
|
||||||
} catch (UnknownHostException e) {
|
} catch (ConnectException e) {
|
||||||
makeServer();
|
makeServer();
|
||||||
}
|
}
|
||||||
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user