docs: function(vector, options) {
      var modbus = this;
      options = options || {};
      var recvBuffer = Buffer.from([]);
  
      // create a tcp server
      modbus._server = net.createServer();
      modbus._server.listen(options.port || MODBUS_PORT, options.host || HOST);
  
      // create a server unit id
      var serverUnitID = options.unitID || UNIT_ID;
  
      // remember open sockets
      modbus.socks = new Map();
  
      modbus._server.on("connection", function(sock) {
          modbus.socks.set(sock, 0);
  
          modbusSerialDebug({
              action: "connected",
              address: sock.address(),
              remoteAddress: sock.remoteAddress,
              localPort: sock.localPort
          });
  
          sock.once("close", function() {
              modbusSerialDebug({
                  action: "closed"
              });
              modbus.socks.delete(sock);
          });
  
          sock.on("data", function(data) {
              modbusSerialDebug({ action: "socket data", data: data });
              recvBuffer = Buffer.concat([recvBuffer, data], recvBuffer.length + data.length);
  
              while(recvBuffer.length > MBAP_LEN) {
                  const transactionsId = recvBuffer.readUInt16BE(0);
                  var pduLen = recvBuffer.readUInt16BE(4);
  
                  // Check the presence of the full request (MBAP + PDU)
                  if(recvBuffer.length - MBAP_LEN < pduLen)
                      break;
  
                  // remove mbap and add crc16
                  var requestBuffer = Buffer.alloc(pduLen + 2);
                  recvBuffer.copy(requestBuffer, 0, MBAP_LEN, MBAP_LEN + pduLen);
  
                  // Move receive buffer on
                  recvBuffer = recvBuffer.slice(MBAP_LEN + pduLen);
  
                  var crc = crc16(requestBuffer.slice(0, -2));
                  requestBuffer.writeUInt16LE(crc, requestBuffer.length - 2);
  
                  modbusSerialDebug({ action: "receive", data: requestBuffer, requestBufferLength: requestBuffer.length });
                  modbusSerialDebug(JSON.stringify({ action: "receive", data: requestBuffer }));
  
                  var sockWriter = function(err, responseBuffer) {
                      if (err) {
                          modbus.emit("error", err);
                          return;
                      }
  
                      // send data back
                      if (responseBuffer) {
                          // remove crc and add mbap
                          var outTcp = Buffer.alloc(responseBuffer.length + 6 - 2);
                          outTcp.writeUInt16BE(transactionsId, 0);
                          outTcp.writeUInt16BE(0, 2);
                          outTcp.writeUInt16BE(responseBuffer.length - 2, 4);
                          responseBuffer.copy(outTcp, 6);
  
                          modbusSerialDebug({ action: "send", data: responseBuffer });
                          modbusSerialDebug(JSON.stringify({ action: "send string", data: responseBuffer }));
  
                          // write to port
                          sock.write(outTcp);
                      }
                  };
  
                  // parse the modbusRTU buffer
                  setTimeout(
                      _parseModbusBuffer.bind(this,
                          requestBuffer,
                          vector,
                          serverUnitID,
                          sockWriter
                      ),
                      0
                  );
              }
          });
  
          sock.on("error", function(err) {
              modbusSerialDebug(JSON.stringify({ action: "socket error", data: err }));
  
              modbus.emit("socketError", err);
          });
      });
      EventEmitter.call(this);
  }