Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package com.pablo67340.textures;
  2.  
  3. import java.io.IOException;
  4. import java.net.InetAddress;
  5. import java.net.ServerSocket;
  6. import java.net.Socket;
  7. import java.net.UnknownHostException;
  8.  
  9. import com.pablo67340.main.Main;
  10.  
  11. public class Webserver extends Thread
  12. {
  13. public Main ft = null;
  14. public boolean running = true;
  15.  
  16. public Webserver(Main f) { this.ft = f; }
  17.  
  18. public void run() {
  19. try {
  20. this.ft.Server = new ServerSocket(this.ft.port, 10, InetAddress.getByName("0"));
  21. }
  22. catch (UnknownHostException e1) {
  23. e1.printStackTrace();
  24. }
  25. catch (IOException e1) {
  26. e1.printStackTrace();
  27. }
  28. do
  29. {
  30. Socket connected = null;
  31. try {
  32. connected = this.ft.Server.accept();
  33. new WebHandler(connected, this).start();
  34. }
  35. catch (IOException localIOException1)
  36. {
  37. }
  38. }
  39. while (this.running);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement