New job packet arrived on MS socket, 1st arg is streamMap, 2nd the socket
168942
function pushMS(data, socket) {
    logger.debug(`newJob Packet arrived w/ ${util.format(data)}`);
    logger.silly(` Memory size vs nWorker :: ${liveMemory.size()} <<>> ${nWorker}`);
    if (liveMemory.size("notBound") >= nWorker) {
        logger.debug("must refuse packet, max pool size reached");
        jmServer.bouncer(data, socket);
        return;
        // No early exit yet
    }
    jmServer.granted(data, socket).then((_data) => {
        let jobProfile = _data.jobProfile;
        _data.fromConsumerMS = true;
        //pool size
        if (jobLib.isJobOptProxy(_data)) {
            logger.debug(`jobOpt successfully decoded`);
        }
        let job = push(jobProfile, _data);
    });
}
218707
public static void main(String[] args) throws InterruptedException {
        StringBuilder errbuf = new StringBuilder();
        try {
            PcapIf pcapIf = pcapIf(errbuf);
            Pcap.Builder builder = new Pcap.Builder()
                    .source(pcapIf.getName())
                    .snaplen(SNAPLEN)
                    .promiscuousMode(PROMISCUOUS)
                    .timeout(TIMEOUT)
                    .immediateMode(IMMEDIATE)
                    .timestampType(TIMESTAMP_TYPE)
                    .timestampPrecision(TIMESTAMP_PRECISION)
                    .rfmon(RFMON)
                    .enableNonBlock(nonBlock)
                    .dataLinkType(LINK_TYPE)
                    .fileName(FILE_NAME)
                    .errbuf(errbuf)
                    .pcapType(PCAP_TYPE);
            com.ardikars.jxnet.context.Application.run("application", "Application", "", builder);
            final Context context = com.ardikars.jxnet.context.Application.getApplicationContext();
            LOGGER.info("Network Interface : " + pcapIf.getName());
            LOGGER.info("Addresses         : ");
            for (PcapAddr addr : pcapIf.getAddresses()) {
                if (addr.getAddr().getSaFamily() == SockAddr.Family.AF_INET) {
                    LOGGER.info("\tAddress       : " + Inet4Address.valueOf(addr.getAddr().getData()));
                    LOGGER.info("\tNetwork       : " + Inet4Address.valueOf(addr.getNetmask().getData()));
                }
            }
            if (Platforms.isWindows()) {
                try {
                    byte[] hardwareAddress = Jxnet.FindHardwareAddress(pcapIf.getName());
                    LOGGER.info("\tMAC Address   : " + MacAddress.valueOf(hardwareAddress));
                } catch (PlatformNotSupportedException e) {
                    LOGGER.warning(e.getMessage());
                } catch (DeviceNotFoundException e) {
                    LOGGER.warning(e.getMessage());
                }
            } else {
                try {
                    LOGGER.info("\tMAC Address   : " + MacAddress.fromNicName(pcapIf.getName()));
                } catch (SocketException e) {
                    LOGGER.warning(e.getMessage());
                }
            }
            final ExecutorService pool = Executors.newCachedThreadPool();
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    pool.shutdownNow();
                }
            });

            final int linktype = context.pcapDataLink().getValue();

            context.pcapLoop(MAX_PACKET, new RawPcapHandler<String>() {

                @Override
                public void nextPacket(String user, int capLen, int len, int tvSec, long tvUsec, long memoryAddress) {
                    Memory buffer = Memories.wrap(memoryAddress, len);
                    buffer.writerIndex(buffer.capacity());
                    Packet packet;
                    if (linktype == 1) {
                        packet = Ethernet.newPacket(buffer);
                    } else {
                        packet = UnknownPacket.newPacket(buffer);
                    }
                    print(Tuple.of(PcapPktHdr.newInstance(capLen, len, tvSec, tvUsec), packet));
                }

            }, "Jxnet!", pool);
            pool.shutdown();
            pool.awaitTermination(WAIT_TIME_FOR_THREAD_TERMINATION, TimeUnit.MICROSECONDS);
        } catch (DeviceNotFoundException e) {
            LOGGER.warning(e.getMessage());
        }

    }
171313
function connection(socket, server) {
  var conn = new Connection(socket)
    , tcp = (server instanceof TcpServer);

  var maxclients = this.conf.get(ConfigKey.MAXCLIENTS);
  if(maxclients && (this.state.length + 1 > maxclients)) {

    this.state.emit('rejected', conn.client.addr, maxclients);

    this.log.debug('rejected %s, exceeds maxclients %s',
      conn.client.addr, maxclients);

    function onWrite() {
      socket.end();
    }

    return conn.write(MaxClients, onWrite.bind(this));
  }

  if(tcp) {
    this.log.debug('accepted connection from %s', conn.client.addr);
  }else if(server) {
    this.log.debug('accepted connection to %s', server.name);
  }else if(!server) {
    this.log.debug('accepted connection in %s', process.pid);
  }

  var timeout = this.conf.get(ConfigKey.TIMEOUT);
  if(typeof timeout === 'number' && timeout) {
    this.log.debug('setting idle timeout for client #%s to %ss',
      conn.id, timeout);
    // config is seconds, socket want milliseconds
    socket.setTimeout(timeout * 1000, function onTimeout() {
      // TODO: log client connection timeout
      socket.destroy();
    })
  }

  conn.once('disconnect', this.disconnect.bind(this));
  conn.on('command', this.command);
  this._state.addConnection(conn);
}
1275939
def _create_sending_stream(self, pub_addr):
        
        sock = self._zmq_context.socket(zmq.PUB)
        sock.setsockopt(zmq.IDENTITY, self.sender_id)
        sock.connect(pub_addr)
        stream = ZMQStream(sock, io_loop=self.io_loop)

        return stream
1010638
private void onRstStreamRead(int streamId, long errorCode) {
    NettyClientStream.TransportState stream = clientStream(connection().stream(streamId));
    if (stream != null) {
      Status status = GrpcUtil.Http2Error.statusForCode((int) errorCode)
          .augmentDescription("Received Rst Stream");
      stream.transportReportStatus(
          status,
          errorCode == Http2Error.REFUSED_STREAM.code()
              ? RpcProgress.REFUSED : RpcProgress.PROCESSED,
          false /*stop delivery*/,
          new Metadata());
      if (keepAliveManager != null) {
        keepAliveManager.onDataReceived();
      }
    }
  }
957724
@Override
  public void start() throws Exception {
    SynchronousQueue<Runnable> synchronousQueue = new SynchronousQueue<>();
    mThreadPool =
        new ThreadPoolExecutor(mMinNumberOfThreads, mMaxNumberOfThreads,
            THREAD_KEEP_ALIVE_TIME_MS, TimeUnit.MILLISECONDS, synchronousQueue);
    mStopped = false;
    try {
      mServerSocket = new ServerSocket(mPort);
    } catch (IOException e) {
      throw new RuntimeException("Failed to bind to port {}.", e);
    }
    while (!mStopped) {
      Socket client;
      try {
        client = mServerSocket.accept();
      } catch (IOException e) {
        if (mServerSocket.isClosed()) {
          break;
        } else {
          continue;
        }
      }
      String clientAddress = client.getInetAddress().getHostAddress();
      LOG.info("Starting thread to read logs from {}", clientAddress);
      AlluxioLog4jSocketNode clientSocketNode = new AlluxioLog4jSocketNode(mBaseLogsDir, client);
      synchronized (mClientSockets) {
        mClientSockets.add(client);
      }
      try {
        CompletableFuture.runAsync(clientSocketNode, mThreadPool)
            .whenComplete((r, e) -> {
              synchronized (mClientSockets) {
                mClientSockets.remove(client);
              }
            });
      } catch (RejectedExecutionException e) {
        // Alluxio log clients (master, secondary master, proxy and workers) establish
        // long-living connections with the log server. Therefore, if the log server cannot
        // find a thread to service a log client, it is very likely due to low number of
        // worker threads. If retry fails, then it makes sense just to let system throw
        // an exception. The system admin should increase the thread pool size.
        String errorMessage = String.format(
            "Log server cannot find a worker thread to service log requests from %s. Increase"
                + " the number of worker threads in the thread pool by configuring"
                + " alluxio.logserver.threads.max in alluxio-site.properties. Current value"
                + " is %d.", clientAddress, mMaxNumberOfThreads);
        throw new RuntimeException(errorMessage, e);
      }
    }
  }
1289772
@Override
  public void deliver(WriteStream os, OutHttp2 outHttp)
    throws IOException
  {
    outHttp.writeBlock(_streamId);
  }
307484
public static void main(String[] arg) {
        InputStream input;
        try {
            input = new FileInputStream("Agogo.ogg");
        } catch (FileNotFoundException ex) {
            LOG.log(Level.SEVERE, null, ex);
            return;
        }

        SyncState oy = new SyncState(); // sync and verify incoming physical bitstream
        StreamState os = new StreamState(); // take physical pages, weld into a logical stream of packets
        Page og = new Page(); // one Ogg bitstream page.  Vorbis packets are inside
        Packet op = new Packet(); // one raw packet of data for decode

        Info vi = new Info(); // struct that stores all the static vorbis bitstream settings
        Comment vc = new Comment(); // struct that stores all the bitstream user comments
        DspState vd = new DspState(); // central working state for the packet->PCM decoder
        Block vb = new Block(vd); // local working space for packet->PCM decode

        byte[] buffer;
        int bytes;

        // Decode setup
        oy.init(); // Now we can read pages

        while (true) { // we repeat if the bitstream is chained
            int eos = 0;

            // grab some data at the head of the stream.  We want the first page
            // (which is guaranteed to be small and only contain the Vorbis
            // stream initial header) We need the first page to get the stream
            // serialno.
            // submit a 4k block to libvorbis' Ogg layer
            int index = oy.buffer(4096);
            buffer = oy.data;
            try {
                bytes = input.read(buffer, index, 4096);
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, null, ex);
                return;
            }
            oy.wrote(bytes);

            // Get the first page.
            if (oy.pageout(og) != 1) {
                // have we simply run out of data?  If so, we're done.
                if (bytes < 4096) {
                    break;
                }

                // error case.  Must not be Vorbis data
                LOG.log(Level.SEVERE, "Input does not appear to be an Ogg bitstream.");
                return;
            }

            // Get the serial number and set up the rest of decode.
            // serialno first; use it to set up a logical stream
            os.init(og.serialno());

            // extract the initial header from the first page and verify that the
            // Ogg bitstream is in fact Vorbis data
            // I handle the initial header first instead of just having the code
            // read all three Vorbis headers at once because reading the initial
            // header is an easy way to identify a Vorbis bitstream and it's
            // useful to see that functionality seperated out.
            vi.init();
            vc.init();
            if (os.pagein(og) < 0) {
                // error; stream version mismatch perhaps
                LOG.log(Level.SEVERE, "Error reading first page of Ogg bitstream data.");
                return;
            }

            if (os.packetout(op) != 1) {
                // no page? must not be vorbis
                LOG.log(Level.SEVERE, "Error reading initial header packet.");
                return;
            }

            if (vi.synthesis_headerin(vc, op) < 0) {
                // error case; not a vorbis header
                LOG.log(Level.SEVERE, "This Ogg bitstream does not contain Vorbis audio data.");
                return;
            }

            // At this point, we're sure we're Vorbis.  We've set up the logical
            // (Ogg) bitstream decoder.  Get the comment and codebook headers and
            // set up the Vorbis decoder
            // The next two packets in order are the comment and codebook headers.
            // They're likely large and may span multiple pages.  Thus we reead
            // and submit data until we get our two pacakets, watching that no
            // pages are missing.  If a page is missing, error out; losing a
            // header page is the only place where missing data is fatal. */
            int i = 0;
            while (i < 2) {
                while (i < 2) {

                    int result = oy.pageout(og);
                    if (result == 0) {
                        break; // Need more data
                    }          // Don't complain about missing or corrupt data yet.  We'll
                    // catch it at the packet output phase

                    if (result == 1) {
                        os.pagein(og); // we can ignore any errors here
                        // as they'll also become apparent
                        // at packetout
                        while (i < 2) {
                            result = os.packetout(op);
                            if (result == 0) {
                                break;
                            }
                            if (result == -1) {
                                // Uh oh; data at some point was corrupted or missing!
                                // We can't tolerate that in a header.  Die.
                                LOG.log(Level.SEVERE, "Corrupt secondary header.  Exiting.");
                                return;
                            }
                            vi.synthesis_headerin(vc, op);
                            i++;
                        }
                    }
                }
                // no harm in not checking before adding more
                index = oy.buffer(4096);
                buffer = oy.data;
                try {
                    bytes = input.read(buffer, index, 4096);
                } catch (Exception ex) {
                    LOG.log(Level.SEVERE, null, ex);
                    return;
                }
                if (bytes == 0 && i < 2) {
                    LOG.log(Level.SEVERE, "End of file before finding all Vorbis headers!");
                    return;
                }
                oy.wrote(bytes);
            }

            // Throw the comments plus a few lines about the bitstream we're
            // decoding
            {
                byte[][] ptr = vc.user_comments;
                for (byte[] ptr1 : ptr) {
                    if (ptr1 == null) {
                        break;
                    }
                    LOG.log(Level.INFO, new String(ptr1, 0, ptr1.length - 1));
                }
                LOG.log(Level.INFO, "\nBitstream is {0} channel, {1}Hz", new Object[]{vi.channels, vi.rate});
                LOG.log(Level.INFO, "Encoded by: {0}\n", new String(vc.vendor, 0, vc.vendor.length - 1));
            }
            // convsize = 4096 / vi.channels; // is this right?

            // OK, got and parsed all three headers. Initialize the Vorbis
            //  packet->PCM decoder.
            vd.synthesis_init(vi); // central decode state
            vb.init(vd); // local state for most of the decode
            // so multiple block decodes can
            // proceed in parallel.  We could init
            // multiple vorbis_block structures
            // for vd here

            float[][][] _pcm = new float[1][][];
            int[] _index = new int[vi.channels];
            // The rest is just a straight decode loop until end of stream
            while (eos == 0) {
                while (eos == 0) {

                    int result = oy.pageout(og);
                    if (result == 0) {
                        break; // need more data
                    }
                    if (result == -1) { // missing or corrupt data at this page position
                        LOG.log(Level.INFO, "Corrupt or missing data in bitstream; continuing...");
                    } else {
                        os.pagein(og); // can safely ignore errors at
                        // this point
                        while (true) {
                            result = os.packetout(op);

                            if (result == 0) {
                                break; // need more data
                            }
                            if (result == -1) { // missing or corrupt data at this page position
                                // no reason to complain; already complained above
                            } else {
                                // we have a packet.  Decode it
                                int samples;
                                if (vb.synthesis(op) == 0) { // test for success!
                                    vd.synthesis_blockin(vb);
                                }

                                // **pcm is a multichannel float vector.  In stereo, for
                                // example, pcm[0] is left, and pcm[1] is right.  samples is
                                // the size of each channel.  Convert the float values
                                // (-1.<=range<=1.) to whatever PCM format and write it out
                                while ((samples = vd.synthesis_pcmout(_pcm, _index)) > 0) {
                                    float[][] pcm = _pcm[0];
                                    int bout = (samples < convsize ? samples : convsize);

                                    // convert floats to 16 bit signed ints (host order) and
                                    // interleave
                                    for (i = 0; i < vi.channels; i++) {
                                        int ptr = i * 2;
                                        //int ptr=i;
                                        int mono = _index[i];
                                        for (int j = 0; j < bout; j++) {
                                            int val = (int) (pcm[i][mono + j] * 32767.);
                                            //		      short val=(short)(pcm[i][mono+j]*32767.);
                                            //		      int val=(int)Math.round(pcm[i][mono+j]*32767.);
                                            // might as well guard against clipping
                                            if (val > 32767) {
                                                val = 32767;
                                            }
                                            if (val < -32768) {
                                                val = -32768;
                                            }
                                            if (val < 0) {
                                                val |= 0x8000;
                                            }
                                            convbuffer[ptr] = (byte) (val);
                                            convbuffer[ptr + 1] = (byte) (val >>> 8);
                                            ptr += 2 * (vi.channels);
                                        }
                                    }

                                    System.out.write(convbuffer, 0, 2 * vi.channels * bout);

                                    // tell libvorbis how
                                    // many samples we
                                    // actually consumed
                                    vd.synthesis_read(bout);
                                }
                            }
                        }
                        if (og.eos() != 0) {
                            eos = 1;
                        }
                    }
                }
                if (eos == 0) {
                    index = oy.buffer(4096);
                    buffer = oy.data;
                    try {
                        bytes = input.read(buffer, index, 4096);
                    } catch (Exception ex) {
                        LOG.log(Level.SEVERE, null, ex);
                        return;
                    }
                    oy.wrote(bytes);
                    if (bytes == 0) {
                        eos = 1;
                    }
                }
            }

            // clean up this logical bitstream; before exit we see if we're
            // followed by another [chained]
            os.clear();

            // ogg_page and ogg_packet structs always point to storage in
            // libvorbis.  They're never freed or manipulated directly
            vb.clear();
            vd.clear();
            vi.clear(); // must be called last
        }

        // OK, clean up the framer
        oy.clear();
        LOG.log(Level.INFO, "Done.");
    }
1153173
public static void main(String[] args) {
        try {
            VBucketInfo vbi[] = new VBucketInfo[1024];
            for (int ii = 0; ii < vbi.length; ++ii) {
                vbi[ii] = new VBucketInfo();
            }
            MemcachedServer server = new MemcachedServer(null, null, 11211, vbi, false);
            for (VBucketInfo aVbi : vbi) {
                aVbi.setOwner(server);
            }
            server.run();
        } catch (IOException e) {
            Logger.getLogger(MemcachedServer.class.getName()).log(Level.SEVERE, "Fatal error! failed to create socket: ", e);
        }
    }
460140
def mavlink_packet(self, m):
        ''''''
        mtype = m.get_type()
        if mtype in ['WAYPOINT_COUNT','MISSION_COUNT']:
            self.wploader.expected_count = m.count
            if self.wp_op is None:
                #self.console.error("No waypoint load started")
                pass
            else:
                self.wploader.clear()
                self.console.writeln("Requesting %u waypoints t=%s now=%s" % (m.count,
                                                                                 time.asctime(time.localtime(m._timestamp)),
                                                                                 time.asctime()))
                self.send_wp_requests()

        elif mtype in ['WAYPOINT', 'MISSION_ITEM'] and self.wp_op is not None:
            if m.seq < self.wploader.count():
                #print("DUPLICATE %u" % m.seq)
                return
            if m.seq+1 > self.wploader.expected_count:
                self.console.writeln("Unexpected waypoint number %u - expected %u" % (m.seq, self.wploader.count()))
            self.wp_received[m.seq] = m
            next_seq = self.wploader.count()
            while next_seq in self.wp_received:
                m = self.wp_received.pop(next_seq)
                self.wploader.add(m)
                next_seq += 1
            if self.wploader.count() != self.wploader.expected_count:
                #print("m.seq=%u expected_count=%u" % (m.seq, self.wploader.expected_count))
                self.send_wp_requests()
                return
            if self.wp_op == 'list':
                for i in range(self.wploader.count()):
                    w = self.wploader.wp(i)
                    print("%u %u %.10f %.10f %f p1=%.1f p2=%.1f p3=%.1f p4=%.1f cur=%u auto=%u" % (
                        w.command, w.frame, w.x, w.y, w.z,
                        w.param1, w.param2, w.param3, w.param4,
                        w.current, w.autocontinue))
                if self.logdir is not None:
                    fname = 'way.txt'
                    if m.get_srcSystem() != 1:
                        fname = 'way_%u.txt' % m.get_srcSystem()
                    waytxt = os.path.join(self.logdir, fname)
                    self.save_waypoints(waytxt)
                    print("Saved waypoints to %s" % waytxt)
                self.loading_waypoints = False
            elif self.wp_op == "save":
                self.save_waypoints(self.wp_save_filename)
            self.wp_op = None
            self.wp_requested = {}
            self.wp_received = {}

        elif mtype in ["WAYPOINT_REQUEST", "MISSION_REQUEST"]:
            self.process_waypoint_request(m, self.master)

        elif mtype in ["WAYPOINT_CURRENT", "MISSION_CURRENT"]:
            if m.seq != self.last_waypoint:
                self.last_waypoint = m.seq
                if self.settings.wpupdates:
                    self.say("waypoint %u" % m.seq,priority='message')

        elif mtype == "MISSION_ITEM_REACHED":
            wp = self.wploader.wp(m.seq)
            if wp is None:
                # should we spit out a warning?!
                # self.say("No waypoints")
                pass
            else:
                if wp.command == mavutil.mavlink.MAV_CMD_DO_LAND_START:
                    alt_offset = self.get_mav_param('ALT_OFFSET', 0)
                    if alt_offset > 0.005:
                        self.say("ALT OFFSET IS NOT ZERO passing DO_LAND_START")
1252857
private void handleNewStreamID(AbstractMessage aMessage, MessageItem msgItem) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleNewStreamID", new Object[] { aMessage, msgItem });

    SIBUuid12 streamID = aMessage.getGuaranteedStreamUUID();

    // Synchronize to resolve race between multiple messages on same
    // stream.  Can't actually happen until multihop, e.g. messages on
    // same stream arrive simultaneously from multiple cellules.
    synchronized (flushMap)
    {
      // Otherwise, create a new flush query record and proceed
      FlushQueryRecord entry = flushMap.get(streamID);

      if ( (entry != null) && (msgItem != null) )
      {
        // Since the entry already exists, somebody else already
        // started the timer so all we have to do is cache the
        // message for replay later.
        entry.append(msgItem);
      }
      else
      {
        // Otherwise, new entry:
        // 1. Create a request ID and flush record, store it in the map.
        // 2. Create and send an "are you flushed".
        // 3. Start an alarm to repeat "are you flushed" a set number of
        //    times.

        SIBUuid8 sourceMEUuid = aMessage.getGuaranteedSourceMessagingEngineUUID();

        SIBUuid12 destID = aMessage.getGuaranteedTargetDestinationDefinitionUUID();
        SIBUuid8  busID  = aMessage.getGuaranteedCrossBusSourceBusUUID();

        // Create and store the request record
        long reqID = messageProcessor.nextTick();
        entry = new FlushQueryRecord(sourceMEUuid, destID, busID,
                                     msgItem, reqID);
        flushMap.put(streamID, entry);

        // Create and send the query
        // TODO: create a proper srcID here
        upControl.sendAreYouFlushedMessage(sourceMEUuid, destID, busID, reqID, streamID);

        // Start the alarm.  The context for the alarm is the stream id, which
        // we can use to look up the FlushQueryRecord if the alarm expires.
        entry.resend = am.create(GDConfig.FLUSH_QUERY_INTERVAL, this, streamID);
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleNewStreamID");
  }
91629
def submit(self, *args, func=None, monitor=None):
        
        monitor = monitor or self.monitor
        func = func or self.task_func
        if not hasattr(self, 'socket'):  # first time
            self.__class__.running_tasks = self.tasks
            self.socket = Socket(self.receiver, zmq.PULL, 'bind').__enter__()
            monitor.backurl = 'tcp://%s:%s' % (
                config.dbserver.host, self.socket.port)
        assert not isinstance(args[-1], Monitor)  # sanity check
        dist = 'no' if self.num_tasks == 1 else self.distribute
        if dist != 'no':
            args = pickle_sequence(args)
            self.sent += numpy.array([len(p) for p in args])
        res = submit[dist](self, func, args, monitor)
        self.tasks.append(res)
1061775
def streamserver_handle(cls, sock, address):
        ''''''
        request = cls.false_request()
        request._sock = sock
        server = None
        log.debug("Accepted connection, starting telnet session.")
        try:
            cls(request, address, server)
        except socket.error:
            pass
601167
def _configure_sockets(self, config, with_streamer=False, with_forwarder=False):
        
        rc_port = config.get('rc_port', 5001)

        self.result_collector.set_hwm(0)
        self.result_collector.bind("tcp://*:{}".format(rc_port))

        self.poller.register(self.result_collector, zmq.POLLIN)
465367
function start(config, setDefaultREPLCommands, getAppInstance) {

  // Defines the IPC socket file path
  var socketAddr = path.join(process.cwd(), 'socket-ctl');

  // Deletes the file if already exists
  if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);

  // Create and start the socket server
  socketServer = net.createServer(function(socket) {

    if(config.replStartMessage) socket.write(config.replStartMessage+"\n");

    // Instantiates a new REPL for this socket
    var socketReplServer = repl.start({
      prompt: config.promptSymbol,
      eval: replEvaluatorBuilder(getAppInstance()),
      input: socket,
      output: socket,
      writer: replWriter,
      terminal: true
    })
    .on("exit", () => {
      socket.end();
    });

    socket.on("error", (err) => {
      console.error(err);
    });

    socketReplServer.context.app = getAppInstance();

    setDefaultREPLCommands(socketReplServer);
  });
  socketServer.listen(socketAddr);
}
717496
@Override
  public void writeMmap(long mmapAddress,
                        long []mmapBlocks,
                        long mmapOffset,
                        long mmapLength)
    throws IOException
  {
    _socket.writeMmap(mmapAddress, mmapBlocks, mmapOffset, mmapLength);
  }
1119843
function spawnProcess (inStream, outStream) {
  var self = this
  var debug = self.debug
  var debugExec = log('netcat:exec')
  /* spawn exec */
  if (self._exec) {
    debug('Spawning', self._exec)
    var sh = null
    if (self._exec.indexOf('|') !== -1) {
      var cmd = (os.platform() === 'win32') ? 'cmd.exe' : 'sh'
      var cmdO = (os.platform() === 'win32') ? '/C' : '-c'
      debug('multiple commands detected, executing under shell:', cmd, cmdO)
      sh = spawn(cmd, [cmdO, self._exec], self._execOptions)
    } else {
      sh = spawn(self._exec, self._execArgs, self._execOptions)
    }
    sh.on('exit', function (code, signal) {
      debug(self._exec, 'exit with', code, signal)
    })
    sh.stdin.resume()
    inStream.pipe(sh.stdin) // incoming data
    sh.stdout.pipe(outStream) // response
    sh.stderr.pipe(outStream)

    sh.stdout.on('data', function (d) {
      debugExec('stdout:', d.toString())
    })
    sh.stderr.on('data', function (e) {
      debugExec('stderr:', e.toString())
    })
  }
}