<commit_before><!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="keywords" content="java, non-blocking,asynchronous,networking,framework,socket,nio,udp,tcp,ssl,tls,dtls,protocol engine">
    <meta name="description" content="An asynchronous event-driven network application framework for quick and easy development of network applications">
    <meta name="author" content="SNF4J.ORG">

    <title>Simple Network Framework for Java</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon">

    <!-- JavaScript plugins (requires jQuery) -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
  </head>
  
  <body>

    <nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
      <a class="navbar-brand" href="#">
        <img src="./img/logo.svg" width="33" height="33" class="d-inline-block align-top" alt="SNF4J"/>
        SNF4J
      </a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarCollapse">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item">
            <a class="nav-link" href="#intro">Intro</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#how">How</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#links">Links</a>
          </li>
        </ul>

        <ul class="navbar-nav flex-row ml-md-auto d-none d-md-flex">
          <li class="nav-item p-2">
            <a href="https://bintray.com/snf4j/maven" rel="nofollow" aria-label="Bintray"><img src="https://api.bintray.com/packages/snf4j/maven/snf4j/images/download.svg" alt="Bintray" title="Bintray"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://search.maven.org/search?q=g:org.snf4j%20AND%20a:snf4j-core&amp;core=gav"><img src="https://img.shields.io/maven-central/v/org.snf4j/snf4j-core.svg" alt="Maven Central" title="Central Repository"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://www.javadoc.io/doc/org.snf4j/snf4j-core"><img src="https://www.javadoc.io/badge/org.snf4j/snf4j-core.svg" alt="Javadocs" title="Javadocs"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://travis-ci.org/snf4j/snf4j" rel="nofollow"><img src="https://camo.githubusercontent.com/c9113c7acaff88a0e074fc0794690161442de8be/68747470733a2f2f7472617669732d63692e6f72672f736e66346a2f736e66346a2e7376673f6272616e63683d6d6173746572" alt="Build Status" title="Build Status" data-canonical-src="https://travis-ci.org/snf4j/snf4j.svg?branch=master"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://codecov.io/github/snf4j/snf4j" rel="nofollow"><img src="https://camo.githubusercontent.com/7186edc4508f9b532d2649a23d033d9e5f0d4d3d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f736e66346a2f736e66346a2e737667" alt="Coverage Status" title="Coverage Status" data-canonical-src="https://img.shields.io/codecov/c/github/snf4j/snf4j.svg"></a>        
          </li>
          <li class="nav-item p-2">
            <a href="https://github.com/snf4j/snf4j/blob/master/LICENSE">
              <img src="https://camo.githubusercontent.com/aeddc50e656d9cfb9c6d8acd755fb59dd772b79a/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667" alt="MIT License" title="MIT License" data-canonical-src="http://img.shields.io/badge/license-MIT-green.svg"> 
            </a>        
          </li>
          <li class="nav-item">
            <a class="nav-link p-2" href="https://github.com/snf4j/snf4j" target="_blank" rel="noopener" aria-label="GitHub">
              <svg class="navbar-nav-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 499.36" width="24" height="24" focusable="false" role="img"><title>GitHub</title><path d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z" fill="currentColor" fill-rule="evenodd"></path></svg>
            </a>
          </li>
        </ul>
      </div>
    </nav>
      
    
<main role="main" class="container">
 <div id="intro" class="jumbotron bg-white">
  <h1>Introduction</h1>
  <hr>
   <p>Simple Network Framework for Java (SNF4J) is an asynchronous event-driven network application framework for quick and easy development of network applications.
   <p>The SNF4J serves as a simple, lightweight and independent network application framework helping in developing high performance and scalable network applications. It provides an asynchronous API via the Java NIO to handle various transports like TCP/IP and UDP/IP.
   <p>The framework is designed to be simple in use and moderately easy to understand. Application developers that like to keep their ear to the ground will not be overwhelmed by a tone of source code. It is oriented towards delivering core networking functionality as transferring data between two or more communicating network applications in a simple but effective way. To provide privacy and integrity of transferred data it provides support for the SSL/TLS/DTLS protocols.

   <div class="float-right mr-5">
    <img src="./img/maindiagram.png">
   </div>

   <br>

   <div class="ml-4">
   
    <h4>Design</h4>
   
    <ul>
     <li> Unified API for transport layer types: TCP and UDP
     <li> Event-driven API for developing asynchronous network applications
     <li> Customizable protocol engines for transport layer types: TCP and UDP
     <li> Utilities for development of UDP server applications
     <li> Simple API for customizable encoder-decoder pipelines
     <li> Provide ease of programing multi-thread applications in a single-thread way
    </ul>
	
    <h4>Performance and Scalability</h4>

    <ul>
     <li> Support for minimized or even zero unnecessary memory coping
     <li> Support for low memory utilization in multi-session applications
     <li> zlib and gzip compression
     <li> Customizable selector loop pooling
     <li> Customizable byte buffer allocators
    </ul>

    <h4>Security</h4>

    <ul>
     <li> Complete support for SSL/TLS/DTLS protocols
    </ul>

    <h4>Integration</h4>

    <ul>
     <li> No additional dependencies, JDK 6 or JDK 9 (for DTLS) is enough
     <li> Fully customizable logging (SLF4J, Log4j 2 already here)
     <li> Customizable thread factories
     <li> Customizable session timers 
     <li> Customizable packet retransmission models during DTLS handshakes
    </ul>

   </div>
  </div>

  <div class="text-center text-black-50">
  <h2>&diams;&diams;&diams;</h2>
  </div>
  
  <div id="how" class="jumbotron bg-white">
    <h1>How to...</h1>
    <hr>

    <p>This is only a very simple overview of the SNF4J API. It covers only basic concepts for implementing client and server networking applications with the SNF4J framework.  More details can be found in the documentation and in the examples that are distributed along with the core source code.

    <h4>Server side</h4>

    <p>Let's start with the server side.  The first thing we have to do is create and start the selector loop that will process signals from the Java NIO.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

SelectorLoop loop = new SelectorLoop();
loop.start();
    </pre>
    </div>

    <p>Next, with the help of the Java NIO API we need to prepare a server socket channel that will handle incoming connections.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

ServerSocketChannel channel = ServerSocketChannel.open();
channel.configureBlocking(false);
channel.socket().bind(new InetSocketAddress(PORT));
    </pre>
    </div>

    <p>To implement server's logic we need to create a handler. It will be receiving events and reading data from the selector loop.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

public class ServerHandler extends AbstractStreamHandler {
    @Override
    public void read(Object msg) {
        //Some code
    }
}    
    </pre>
    </div><commit_msg>Update site content [ci skip]<commit_after><!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="keywords" content="java, non-blocking,asynchronous,networking,framework,socket,nio,udp,tcp,ssl,tls,dtls,protocol engine">
    <meta name="description" content="An asynchronous event-driven network application framework for quick and easy development of network applications">
    <meta name="author" content="SNF4J.ORG">

    <title>Simple Network Framework for Java</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon">

    <!-- JavaScript plugins (requires jQuery) -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="<KEY>" crossorigin="anonymous"></script>
  </head>
  
  <body>

    <nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
      <a class="navbar-brand" href="#">
        <img src="./img/logo.svg" width="33" height="33" class="d-inline-block align-top" alt="SNF4J"/>
        SNF4J
      </a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarCollapse">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item">
            <a class="nav-link" href="#intro">Intro</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#how">How</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#links">Links</a>
          </li>
        </ul>

        <ul class="navbar-nav flex-row ml-md-auto d-none d-md-flex">
          <li class="nav-item p-2">
            <a href="https://bintray.com/snf4j/maven" rel="nofollow" aria-label="Bintray"><img src="https://api.bintray.com/packages/snf4j/maven/snf4j/images/download.svg" alt="Bintray" title="Bintray"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://search.maven.org/search?q=g:org.snf4j%20AND%20a:snf4j-core&amp;core=gav"><img src="https://img.shields.io/maven-central/v/org.snf4j/snf4j-core.svg" alt="Maven Central" title="Central Repository"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://www.javadoc.io/doc/org.snf4j/snf4j-core"><img src="https://www.javadoc.io/badge/org.snf4j/snf4j-core.svg" alt="Javadocs" title="Javadocs"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://travis-ci.org/snf4j/snf4j" rel="nofollow"><img src="https://camo.githubusercontent.com/c9113c7acaff88a0e074fc0794690161442de8be/68747470733a2f2f7472617669732d63692e6f72672f736e66346a2f736e66346a2e7376673f6272616e63683d6d6173746572" alt="Build Status" title="Build Status" data-canonical-src="https://travis-ci.org/snf4j/snf4j.svg?branch=master"></a>
          </li>
          <li class="nav-item p-2">
            <a href="https://codecov.io/github/snf4j/snf4j" rel="nofollow"><img src="https://camo.githubusercontent.com/7186edc4508f9b532d2649a23d033d9e5f0d4d3d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f736e66346a2f736e66346a2e737667" alt="Coverage Status" title="Coverage Status" data-canonical-src="https://img.shields.io/codecov/c/github/snf4j/snf4j.svg"></a>        
          </li>
          <li class="nav-item p-2">
            <a href="https://github.com/snf4j/snf4j/blob/master/LICENSE">
              <img src="https://camo.githubusercontent.com/aeddc50e656d9cfb9c6d8acd755fb59dd772b79a/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667" alt="MIT License" title="MIT License" data-canonical-src="http://img.shields.io/badge/license-MIT-green.svg"> 
            </a>        
          </li>
          <li class="nav-item">
            <a class="nav-link p-2" href="https://github.com/snf4j/snf4j" target="_blank" rel="noopener" aria-label="GitHub">
              <svg class="navbar-nav-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 499.36" width="24" height="24" focusable="false" role="img"><title>GitHub</title><path d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z" fill="currentColor" fill-rule="evenodd"></path></svg>
            </a>
          </li>
        </ul>
      </div>
    </nav>
      
    
<main role="main" class="container">
 <div id="intro" class="jumbotron bg-white">
  <h1>Introduction</h1>
  <hr>
   <p>Simple Network Framework for Java (SNF4J) is an asynchronous event-driven network application framework for quick and easy development of network applications.
   <p>The SNF4J serves as a simple, lightweight and independent network application framework helping in developing high performance and scalable network applications. It provides an asynchronous API via the Java NIO to handle various transports like TCP/IP and UDP/IP.
   <p>The framework is designed to be simple in use and moderately easy to understand. Application developers that like to keep their ear to the ground will not be overwhelmed by a tone of source code. It is oriented towards delivering core networking functionality as transferring data between two or more communicating network applications in a simple but effective way. To provide privacy and integrity of transferred data it provides support for the SSL/TLS/DTLS protocols.

   <div class="float-right mr-5">
    <img src="./img/maindiagram.png">
   </div>

   <br>

   <div class="ml-4">
   
    <h4>Design</h4>
   
    <ul>
     <li> Unified API for transport layer types: TCP and UDP
     <li> Event-driven API for developing asynchronous network applications
     <li> Customizable protocol engines for transport layer types: TCP and UDP
     <li> Utilities for development of UDP server applications
     <li> Simple API for customizable encoder-decoder pipelines
     <li> Provide ease of programing multi-thread applications in a single-thread way
    </ul>
	
    <h4>Performance and Scalability</h4>

    <ul>
     <li> Support for minimized or even zero unnecessary memory coping
     <li> Support for low memory utilization in multi-session applications
     <li> zlib and gzip compression
     <li> Customizable selector loop pooling
     <li> Customizable byte buffer allocators
    </ul>

    <h4>Security</h4>

    <ul>
     <li> Complete support for SSL/TLS/DTLS protocols
    </ul>

    <h4>Integration</h4>

    <ul>
     <li> No additional dependencies, JDK 6 or JDK 9 (for DTLS) is enough
     <li> Fully customizable logging (SLF4J, Log4j 2 already here)
     <li> Customizable thread factories
     <li> Customizable session timers 
     <li> Customizable packet retransmission models during DTLS handshakes
    </ul>

   </div>
  </div>

  <div class="text-center text-black-50">
  <h2>&diams;&diams;&diams;</h2>
  </div>
  
  <div id="how" class="jumbotron bg-white">
    <h1>How to...</h1>
    <hr>

    <p>This is only a very simple overview of the SNF4J API. It covers only basic concepts for implementing client and server networking applications with the SNF4J framework.  More details can be found in the documentation and in the examples that are distributed along with the core source code.

    <h4>Server side</h4>

    <p>Let's start with the server side.  The first thing we have to do is create and start the selector loop that will process signals from the Java NIO.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

SelectorLoop loop = new SelectorLoop();
loop.start();
    </pre>
    </div>

    <p>Next, with the help of the Java NIO API we need to prepare a server socket channel that will handle incoming connections.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

ServerSocketChannel channel = ServerSocketChannel.open();
channel.configureBlocking(false);
channel.socket().bind(new InetSocketAddress(PORT));
    </pre>
    </div>

    <p>To implement server's logic we need to create a handler. It will be receiving events from the selector loop and data read from the socket channel.
    
    <p><div class="jumbotron bg-gray text-dark ml-5 mr-5 pt-0 pb-1">
    <pre class="text-dark">

public class ServerHandler extends AbstractStreamHandler {
    @Override
    public void read(Object msg) {
        //Some code
    }
}    
    </pre>
    </div>
{'fraction_non_alphanumeric': 0.14102898929224342, 'fraction_numerical': 0.09798903107861061, 'mean_word_length': 3.238653973876467, 'pattern_counts': {'":': 0, '<': 337, '<?xml version=': 0, '>': 337, 'https://': 36, 'lorem ipsum': 0, 'www.': 6, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6765457', 'n_tokens_mistral': 7843, 'n_tokens_neox': 6592, 'n_words': 1635}