GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
democall3
Browse code
Made the server threads deamon threads. No real need too but it is the correct thing to do.
master
1 parent
ee66ee8
commit
455ca5995d5e4dfe46bf5dca539b5bab6f134fec
Mark
authored
on 1 Mar 2011
Patch
Showing
1 changed file
src/server/Server.java
Ignore Space
Show notes
View
src/server/Server.java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package server; import gui.MapPanel303; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import javax.swing.JFrame; /** * * @author geoma48p */ public class Server { public static void main(String[] args) throws IOException { System.out.println("Server"); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MapPanel303 panel = new MapPanel303(); frame.add(panel); frame.pack(); frame.setVisible(true); ServerSocket ss = new ServerSocket(7321); while (true) { Socket socket = ss.accept(); Thread thread = new Thread(new RequestThread(panel, socket)); thread.setDaemon(true); thread.start(); } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package server; import gui.MapPanel303; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import javax.swing.JFrame; import javax.swing.SwingUtilities; /** * * @author geoma48p */ public class Server { public static void main(String[] args) throws IOException { System.out.println("Server"); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MapPanel303 panel = new MapPanel303(); frame.add(panel); frame.pack(); frame.setVisible(true); ServerSocket ss = new ServerSocket(7321); while (true) { Socket socket = ss.accept(); new Thread(new RequestThread(panel, socket)).start(); } } }
Show line notes below