package vd.server.network;

import vd.core.log.Logger;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class NetworkEngine
{
    private ServerSocket server;
    private Logger logger;
    private Thread thread;
    private boolean running;

    private int port;

    private List<ClientInstance> clients = new ArrayList<>();

    public NetworkEngine(Logger l)
    {
        logger = l;
    }

    public void init(int p)
    {
        port = p;
    }

    public void start()
    {
        thread = new Thread(() -> {
            try
            {
                server = new ServerSocket(port);

                Socket ns;

                while(running)
                {
                    ns = server.accept();


                }
            }
            catch (Exception e)
            {

            }
        });

        thread.start();
    }

    public void stop()
    {
        running = false;
    }
}
