old_contents: net = require( 'net' );
  
  var clients = [];
  
  var socket = net.createServer( function ( socket ) {
    socket.name = socket.remoteAddress + ":" + socket.remotePort;
    socket.id = clients.length;
    clients.push( socket );
    console.log( "connected to client " + socket.name );
  
    var clientID = new Buffer( [ 255, clients.length - 1 ] );
    socket.write( clientID );
    var clientJoinMsg = new Buffer( [ 254, clients.length - 1 ] );
    clients.forEach( function( client ) {
      if ( client == socket ) return;
      client.write( clientJoinMsg );
    } );
  
    socket.on( 'data', function( data ) {
      console.log( data );
      relay( data, socket );
    } );
  
    socket.on( 'end', function() {
      clients.splice( clients.indexOf( socket ), 1 );
      // relay leave event
      console.log( "client " + socket.name + " left the game." );
    } );
  
    function relay( data, sender ) {
      clients.forEach( function( client ) {
        if ( client == sender ) return;
        var posID = new Buffer( [ 253, sender.id ] );
        client.write( posID );
        client.write( data );
      } );
    }
  } ).listen( process.env.PORT || 5000, null );
  
new_contents: net = require( 'net' );
  
  var clients = [];
  
  var socket = net.createServer( function ( socket ) {
    socket.name = socket.remoteAddress + ":" + socket.remotePort;
    socket.id = clients.length;
    clients.push( socket );
    console.log( "connected to client " + socket.name );
  
    var clientID = new Buffer( [ 255, clients.length - 1 ] );
    socket.write( clientID );
    var socketJoin = new Buffer( [ 254, clients.length - 1 ] );
    clients.forEach( function( client, clientIndex ) {
      if ( client == socket ) return;
      client.write( socketJoin );
      var clientAdd = new Buffer( [ 254, clientIndex ] );
      socket.write( clientAdd );
    } );
  
    socket.on( 'data', function( data ) {
      console.log( data );
      relay( data, socket );
    } );
  
    socket.on( 'end', function() {
      clients.splice( clients.indexOf( socket ), 1 );
      // relay leave event
      console.log( "client " + socket.name + " left the game." );
    } );
  
    function relay( data, sender ) {
      clients.forEach( function( client ) {
        if ( client == sender ) return;
        var posID = new Buffer( [ 253, sender.id ] );
        client.write( posID );
        client.write( data );
      } );
    }
  } ).listen( process.env.PORT || 5000, null );
  
subject: send current players to new player on join so first player exist on on second player's machine