java - BungeeCord not reachable after enabling ServerSocket -


i'm working on web based api bungeecord server after opening serversocket on port 8082 bungeecord on port 25565 isn't available furthermore.

this class opening serversocket:

package de.pardrox.bungeeapi; import java.io.bufferedreader;  import java.io.inputstreamreader; import java.io.printwriter; import java.net.inetaddress; import java.net.serversocket; import java.net.socket;  public class http {     static router router = new router();   public static void main(int args) {     try {             int port = args;       @suppresswarnings("resource")     serversocket apiweb = new serversocket(port);       (;;) {         socket client = apiweb.accept();         bufferedreader in = new bufferedreader(new inputstreamreader(client.getinputstream()));         printwriter out = new printwriter(client.getoutputstream());          out.print("http/1.1 200 \r\n");         out.print("content-type: text/plain\r\n");         out.print("connection: close\r\n");         out.print("\r\n");          string line;         inetaddress ip_client = client.getinetaddress();         main.syslog("request of client "+ip_client.tostring());         while ((line = in.readline()) != null) {           if (line.length() == 0)             break;             if(line.tolowercase().contains("get".tolowercase()))             {                 string url = line.replace("get ", "").replace(" http/1.1", "");                 out.print(router.get(url));             }         }         out.close();         in.close();         client.close();       }     }     catch (exception e) {       system.err.println(e);       system.err.println("call http(<port>)");     }   } } 

does have idea why opening serversocket seems close socket of gameserver? eclipse doesn't find error , gameserver seems run fine. api reachable without trouble.

for completeness: i've startet socket class http.main(8082);

i think there's mistake @ for (;;). create infinite loop run ever.... maybe cause main thread of bungeecord server stop responding. try removing for (;;) , using code below instead of running code in default bungeecord thread. since bungeecord doesn't allows create custom threads, way using scheduler , running runnable asynchronous.

proxyserver.getinstance().getscheduler().runasync(yourpluginhere, new runnable() {     @override     public void run() {         // put code here     } }); 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -