App now asks for address

This commit is contained in:
Marcin Kostrzewski 2020-10-29 17:18:49 +01:00
parent 6e0ad2c943
commit 355b83a97a

View File

@ -4,13 +4,17 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.Scanner;
public class App {
private static final Logger logger = LogManager.getLogger(App.class);
public static void main(String[] args){
try {
Connection connection = new Connection("localhost");
Scanner scanner = new Scanner(System.in);
System.out.print("Enter server IP address (leave blank if hosting): ");
String address = scanner.nextLine();
Connection connection = new Connection(address);
Interactive interactive = new Interactive(connection.getIn(), connection.getOut());
interactive.beginLoopAs(connection.isHost());