<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses('peer.ServerSocket');

  /**
   * Basic TCP/IP Server
   *
   * <code>
   *   uses('peer.server.Server');
   *   
   *   $server= new Server('127.0.0.1', 6100);
   *   $server->setProtocol(new MyProtocol());
   *   try {
   *     $server->init();
   *     $server->service();
   *     $server->shutdown();
   *   } catch(XPException $e) {
   *     $e->printStackTrace();
   *     exit(-1);
   *   }
   * </code>
   *
   * @ext      sockets
   * @see      xp://peer.ServerSocket
   * @purpose  TCP/IP Server
   */
  class Server extends Object {
    public
      $protocol   = NULL,
      $socket     = NULL,
      $server     = NULL,
      $terminate  = FALSE,
      $tcpnodelay = FALSE;
    /**
     * Constructor
     *
     * @param   string addr
     * @param   int port
     */
    public function __construct($addr, $port) {
      $this->socket= new ServerSocket($addr, $port);
    }
    
    /**
     * Initialize the server
     *
     */
    public function init() {
      $this->socket->create();
      $this->socket->bind(TRUE);
      $this->socket->listen();
    }
    
    /**
     * Shutdown the server<commit_msg>- QA: WS<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses('peer.ServerSocket');

  /**
   * Basic TCP/IP Server
   *
   * <code>
   *   uses('peer.server.Server');
   *   
   *   $server= new Server('127.0.0.1', 6100);
   *   $server->setProtocol(new MyProtocol());
   *   try {
   *     $server->init();
   *     $server->service();
   *     $server->shutdown();
   *   } catch(XPException $e) {
   *     $e->printStackTrace();
   *     exit(-1);
   *   }
   * </code>
   *
   * @ext      sockets
   * @see      xp://peer.ServerSocket
   * @purpose  TCP/IP Server
   */
  class Server extends Object {
    public
      $protocol   = NULL,
      $socket     = NULL,
      $server     = NULL,
      $terminate  = FALSE,
      $tcpnodelay = FALSE;

    /**
     * Constructor
     *
     * @param   string addr
     * @param   int port
     */
    public function __construct($addr, $port) {
      $this->socket= new ServerSocket($addr, $port);
    }
    
    /**
     * Initialize the server
     *
     */
    public function init() {
      $this->socket->create();
      $this->socket->bind(TRUE);
      $this->socket->listen();
    }
    
    /**
     * Shutdown the server
{'fraction_non_alphanumeric': 0.1674917491749175, 'fraction_numerical': 0.009075907590759076, 'mean_word_length': 1.7339346110484781, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6879932', 'n_tokens_mistral': 833, 'n_tokens_neox': 809, 'n_words': 161}