Skip to content

Instantly share code, notes, and snippets.

@nkalra0123
Created June 27, 2021 12:07
Show Gist options
  • Save nkalra0123/8a4f5737037be7cb8aa0acbf339309fc to your computer and use it in GitHub Desktop.
Save nkalra0123/8a4f5737037be7cb8aa0acbf339309fc to your computer and use it in GitHub Desktop.
do {
try {
final Socket finalAccept = httpd.getMyServerSocket().accept();
if (this.timeout > 0) {
finalAccept.setSoTimeout(this.timeout);
}
final InputStream inputStream = finalAccept.getInputStream();
httpd.asyncRunner.exec(httpd.createClientHandler(finalAccept, inputStream));
} catch (IOException e) {
NanoHTTPD.LOG.log(Level.FINE, "Communication with the client broken", e);
}
} while (!httpd.getMyServerSocket().isClosed());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment