Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2022
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public static void main(String[] args) {
  2. // TODO Auto-generated method stub
  3. BufferUI window = new BufferUI();
  4. window.frame.setVisible(true);
  5. }
  6.  
  7. private static final int PORT = 65000; // random large port number
  8. private static ServerSocket s;
  9.  
  10. // static initializer
  11. static {
  12. try {
  13. s = new ServerSocket(PORT, 10, InetAddress.getLocalHost());
  14. } catch (UnknownHostException e) {
  15. // shouldn't happen for localhost
  16. } catch (IOException e) {
  17. // port taken, so app is already running
  18.  
  19. System.exit(0);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement