Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ServerManager extends Application{
- public static final int PORT = 2000;
- public static void main(String[] args) throws IOException {
- ServerSocket s = new ServerSocket(PORT);
- System.out.println("Server socket: " + s);
- System.out.println("Server listening...");
- try {
- while (true) {
- // Wait For Connection
- Socket socket = s.accept();
- System.out.println("Connection accepted.");
- System.out.println("The new socket: " + socket);
- try {
- GraphicsManager gm = new GraphicsManager();
- gm.createBalls(1, 10, 20, 10, 20, 0, 0);
- //gm.start(THESTAGE_BUT_IS_NOT_ACCESSIBLE);
- //How would i access the stage-object here? ^
- ClientThread t = new ClientThread(socket);
- System.out.println("New thread started.");
- System.out.println("The new thread: " + t);
- } catch (IOException e) {
- socket.close();
- }
- }
- } // catch, while, try
- finally {
- s.close();
- }
- }
- //The code below is never run for some reason?
- @Override
- public void start(Stage primaryStage) throws Exception {
- GraphicsManager gm = new GraphicsManager();
- gm.start(primaryStage);
- }
- }
Add Comment
Please, Sign In to add comment