aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl/xblast/server/Server.java
blob: 76f332efb76bff1ef1d861bbc017a3603cc70d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ch.epfl.xblast.server;

import ch.epfl.xblast.PlayerID;

import java.net.InetSocketAddress;
import java.util.Optional;

/**
 * The Server class.
 *
 * @author Pacien TRAN-GIRARD (261948)
 */
public class Server {

    public static final int DEFAULT_PORT = 2016;
    public static final int DEFAULT_EXPECTED_CLIENTS = PlayerID.values().length;

    private final InetSocketAddress iface;
    private final int expectedClients;

    public Server(String iface, Integer port, Integer expectedClients) {
        this.iface = new InetSocketAddress(iface, Optional.ofNullable(port).orElse(DEFAULT_PORT));
        this.expectedClients = Optional.ofNullable(expectedClients).orElse(DEFAULT_EXPECTED_CLIENTS);
    }

    public void run() {
        // TODO
    }

}