interface %s
   ip ospf transmit-delay %d
182109
def transmit_delay=(val)
      no_cmd = (val == default_transmit_delay) ? 'no' : ''
      delay = (val == default_transmit_delay) ? '' : val
      config_set('interface_ospf', 'transmit_delay',
                 @interface.name, no_cmd, delay)
    end
955697
def _send(self, ip, port, data):
        
        return self._listen_socket.sendto(data, (ip, port))
243433
def cli(port, baud, delay):
    
    global _board
    # On Windows fix the COM port path name for ports above 9 (see comment in
    # windows_full_port_name function).
    if platform.system() == "Windows":
        port = windows_full_port_name(port)
    _board = pyboard.Pyboard(port, baudrate=baud, rawdelay=delay)
1145746
def process_IAC(self, sock, cmd, option):
        
        if cmd == DO:
            if option == TM:
                # timing mark - send WILL into outgoing stream
                os.write(self.remote, IAC + WILL + TM)
            else:
                pass
        elif cmd == IP:
            # interrupt process
            os.write(self.local, IPRESP)
        elif cmd == SB:
            pass
        elif cmd == SE:
            option = self.sbdataq[0]
            if option == NAWS[0]:
                # negotiate window size.
                cols = six.indexbytes(self.sbdataq, 1)
                rows = six.indexbytes(self.sbdataq, 2)
                s = struct.pack('HHHH', rows, cols, 0, 0)
                fcntl.ioctl(self.local, termios.TIOCSWINSZ, s)
        elif cmd == DONT:
            pass
        else:
            pass
554714
def i2m(self, pkt, i):
        """""""
        mask, ip = i
        ip = socket.inet_aton(ip)
        return struct.pack(">B", mask) + ip[:self.mask2iplen(mask)]
975123
def send_data(self, data, delay=COMMAND_DELAY):
        

        time_since_last_send = time.time() - self._last_send
        delay = max(0, delay - time_since_last_send)
        time.sleep(delay)  # Ensure minim recommended delay since last send

        for item in data:
            data = bytes.fromhex(str(item.zfill(2)))
            try:
                self.sock.send(data)
            except ConnectionResetError as msg:
                _LOGGER.error("Error trying to connect to Russound controller. "
                              "Check that no other device or system is using the port that "
                              "you are trying to connect to. Try resetting the bridge you are using to connect.")
                _LOGGER.error(msg)
        self._last_send = time.time()
197732
def setNetworkIDTimeout(self, iNwkIDTimeOut):
        
        print '%s call setNetworkIDTimeout' % self.port
        print iNwkIDTimeOut
        iNwkIDTimeOut /= 1000
        try:
            cmd = 'networkidtimeout %s' % str(iNwkIDTimeOut)
            print cmd
            return self.__sendCommand(cmd)[0] == 'Done'
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("setNetworkIDTimeout() Error: " + str(e))
923161
private boolean skipInterface(NetworkInterface ni) throws SocketException {
        boolean skipInterface = !ni.isUp() || ni.isVirtual() || ni.isLoopback();
        if (skipInterface && logger.isFineEnabled()) {
            logger.fine("Skipping NetworkInterface '" + ni.getName() + "': isUp=" + ni.isUp() + ", isVirtual=" + ni.isVirtual()
                    + ", isLoopback=" + ni.isLoopback());
        }
        return skipInterface;
    }
25671
def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None,
          verbose=None, realtime=None,
          return_packets=False, socket=None, *args, **kargs):
    """"""
    if iface is None and iface_hint is not None and socket is None:
        iface = conf.route.route(iface_hint)[0]
    need_closing = socket is None
    socket = socket or conf.L2socket(iface=iface, *args, **kargs)
    results = __gen_send(socket, x, inter=inter, loop=loop,
                         count=count, verbose=verbose,
                         realtime=realtime, return_packets=return_packets)
    if need_closing:
        socket.close()
    return results
757041
function validateAddrs (msg, streamHandler, type, cb) {
    try {
      msg.dstPeer.addrs.forEach((addr) => {
        return multiaddr(addr)
      })
    } catch (err) {
      writeResponse(streamHandler, type === proto.CircuitRelay.Type.HOP
        ? proto.CircuitRelay.Status.HOP_DST_MULTIADDR_INVALID
        : proto.CircuitRelay.Status.STOP_DST_MULTIADDR_INVALID)
      return cb(err)
    }

    try {
      msg.srcPeer.addrs.forEach((addr) => {
        return multiaddr(addr)
      })
    } catch (err) {
      writeResponse(streamHandler, type === proto.CircuitRelay.Type.HOP
        ? proto.CircuitRelay.Status.HOP_SRC_MULTIADDR_INVALID
        : proto.CircuitRelay.Status.STOP_SRC_MULTIADDR_INVALID)
      return cb(err)
    }

    return cb(null)
  }
1143904
def start_client(self, host, port=5001, protocol='TCP', timeout=5,
                     parallel=None, bandwidth=None):
        
        cmd = ['iperf',  '-c', host, '-p', str(port), '-t', str(timeout)]
        if not (protocol, 'UDP'):
            cmd.append('-u')
        if parallel:
            cmd.extend(['-P', str(parallel)])
        if bandwidth:
            cmd.extend(['-b', '%sM' % bandwidth])
        stdcode, stdout, stderr = utils.execute_wait(cmd)
        if (not stdcode) or (not stderr):
            out_dict = stdout.split('\n')
            if not out_dict[-1]:
                out_dict.pop()
            out_data = out_dict[-1].split()
            data = dict()
            data['Bandwidth'] = out_data[-2] + ' ' + out_data[-1]
            data['Transfer'] = out_data[-4] + ' ' + out_data[-3]
            data['Interval'] = out_data[-6]
            return data
        raise Exception('Start iperf failed, please check on the node.')
528668
def ping(self, ips, boardcast=False,
             count=2, timeout=2, interface=None):
        
        cmd = ['ping', '-c', str(count), '-W', str(timeout)]
        True if not interface else cmd.extend(['-I', interface])
        True if not boardcast else cmd.append('-b')
        # Batch create subprocess
        data = dict()
        try:
            for ip in ips:
                stdcode, stdout = agent_utils.execute(cmd + [ip])
                if stdcode:
                    data[ip] = 100
                else:
                    pattern = r',\s([0-9]+)%\spacket\sloss'
                    data[ip] = re.search(pattern, stdout[-2]).groups()[0]
            return agent_utils.make_response(code=0, data=data)
        except Exception as e:
            message = e.message
            return agent_utils.make_response(code=1, message=message)
1102928
int getInterFrameDelay() {
        if (commPort.getBaudRate() > 19200) {
            return 1750;
        }
        else {
            return Math.max(getCharInterval(Modbus.INTER_MESSAGE_GAP), Modbus.MINIMUM_TRANSMIT_DELAY);
        }
    }
1133457
def _send_ping(self, dest_addr, payload):
        
        pkt_id = self._last_used_id

        is_ipv6 = ':' in dest_addr
        if is_ipv6:
            self._ipv6_address_present = True
            icmp_echo_request = _ICMPV6_ECHO_REQUEST
        else:
            icmp_echo_request = _ICMP_ECHO_REQUEST

        # For checksum calculation we require a dummy header, with the checksum
        # field set to zero. This header consists of:
        # - ICMP type = 8 (v4) / 128 (v6) (unsigned byte)
        # - ICMP code = 0 (unsigned byte)
        # - checksum  = 0 (unsigned short)
        # - packet id     (unsigned short)
        # - sequence  = 0 (unsigned short)  This doesn't have to be 0.
        dummy_header = bytearray(
                            struct.pack(_ICMP_HDR_PACK_FORMAT,
                                        icmp_echo_request, 0, 0,
                                        pkt_id, self.ident))

        # Calculate the checksum over the combined dummy header and payload
        checksum = self._checksum(dummy_header + payload)

        # We can now create the real header, which contains the correct
        # checksum. Need to make sure to convert checksum to network byte
        # order.
        real_header = bytearray(
                            struct.pack(_ICMP_HDR_PACK_FORMAT,
                                        icmp_echo_request, 0, checksum,
                                        pkt_id, self.ident))

        # Full packet consists of header plus payload
        full_pkt = real_header + payload

        # The full address for a sendto operation consists of the IP address
        # and a port. We don't really need a port for ICMP, so we just use 0
        # for that.
        full_dest_addr = (dest_addr, 0)

        if is_ipv6:
            socket.inet_pton(socket.AF_INET6, dest_addr)
            try:
                self._sock6.sendto(full_pkt, full_dest_addr)
            except Exception:
                # on systems without IPv6 connectivity, sendto will fail with
                # 'No route to host'
                pass
        else:
            self._sock.sendto(full_pkt, full_dest_addr)
497624
def enable(self, cmd="sudo su", pattern="ssword", re_flags=re.IGNORECASE):
        """"""
        delay_factor = self.select_delay_factor(delay_factor=0)
        output = ""
        if not self.check_enable_mode():
            self.write_channel(self.normalize_cmd(cmd))
            time.sleep(0.3 * delay_factor)
            try:
                output += self.read_channel()
                if re.search(pattern, output, flags=re_flags):
                    self.write_channel(self.normalize_cmd(self.secret))
                self.set_base_prompt()
            except socket.timeout:
                raise NetMikoTimeoutException(
                    "Timed-out reading channel, data not available."
                )
            if not self.check_enable_mode():
                msg = (
                    "Failed to enter enable mode. Please ensure you pass "
                    "the 'secret' argument to ConnectHandler."
                )
                raise ValueError(msg)
        return output
840752
private void setUpTransmitter(String params) throws IOException {
        log.info("Starting UDP transmitter for: " + params);
        if (!params.contains(DVOETOCHIE)) {
            throw new IllegalArgumentException("Wrong syntax for udp-transmitter command: " + params);
        }
        String transmitToAddr = params.substring(0, params.indexOf(DVOETOCHIE)).trim();
        params = params.substring(params.indexOf(DVOETOCHIE) + 1).trim();

        if (!params.contains(DVOETOCHIE)) {
            throw new IllegalArgumentException("Wrong syntax for udp-transmitter command: " + params);
        }
        int transmitToPort = Integer.parseInt(params.substring(0, params.indexOf(DVOETOCHIE)).trim());
        params = params.substring(params.indexOf(DVOETOCHIE) + 1).trim();

        setUpMetrics(params.split(TAB));
        DatagramChannel transmitter = DatagramChannel.open();
        SocketAddress addr = new InetSocketAddress(transmitToAddr, transmitToPort);
        transmitter.connect(addr);
        transmitter.configureBlocking(false);
        controller.registerWritingChannel(transmitter, this);
        controller.connectUDPClient(addr, transmitter, this);
    }
458358
function (testOverride) {
    var ret = '127.0.0.1'
    os = testOverride || os
    var interfaces = os.networkInterfaces()

    Object.keys(interfaces).forEach(function (el) {
      interfaces[el].forEach(function (el2) {
        if (!el2.internal && el2.family === 'IPv4') {
          ret = el2.address
        }
      })
    })

    return ret
  }