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

28
LINES

< > BotCompany Repo | #1001648 // serveHttp function

JavaX fragment (include)

static MyHTTPD serveHttp_server;
static int serveHttp_port = 8888;

static new TreeSet<String> serveHttp_peers;

static int serveHttp(int port) ctex {
  serveHttp_port = port;
  serveHttp_server = new MyHTTPD(port);
  serveHttp_server.start();
  ret serveHttp_port();
}

// serve on random port, return port number used
static int serveHttp() {
  serveHttp(0);
  ret serveHttp_port();
}

static int serveHttp_port() {
  ret serveHttp_server == null ? 0 : serveHttp_server.getListeningPort();
}

static void cleanMeUp_serveHttp() {
  if (serveHttp_server != null) {
    serveHttp_server.stop();
    serveHttp_server = null;
  }
}

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: 799 / 1378
Version history: 14 change(s)
Referenced in: [show references]