Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > BotCompany Repo | #1001648 // serveHttp function

JavaX fragment (include)

1  
static MyHTTPD serveHttp_server;
2  
static int serveHttp_port = 8888;
3  
4  
static new TreeSet<String> serveHttp_peers;
5  
6  
static int serveHttp(int port) ctex {
7  
  serveHttp_port = port;
8  
  serveHttp_server = new MyHTTPD(port);
9  
  serveHttp_server.start();
10  
  ret serveHttp_port();
11  
}
12  
13  
// serve on random port, return port number used
14  
static int serveHttp() {
15  
  serveHttp(0);
16  
  ret serveHttp_port();
17  
}
18  
19  
static int serveHttp_port() {
20  
  ret serveHttp_server == null ? 0 : serveHttp_server.getListeningPort();
21  
}
22  
23  
static void cleanMeUp_serveHttp() {
24  
  if (serveHttp_server != null) {
25  
    serveHttp_server.stop();
26  
    serveHttp_server = null;
27  
  }
28  
}

Author comment

Began life as a copy of #1001647

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001648
Snippet name: serveHttp function
Eternal ID of this version: #1001648/15
Text MD5: ea2b9cfefe7700fb4e1713e2963955b1
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-08 03:56:27
Source code size: 655 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 801 / 1381
Version history: 14 change(s)
Referenced in: [show references]