Tabnine Logo
RawSocket
Code IndexAdd Tabnine to your IDE (free)

How to use
RawSocket
in
libcore.net

Best Java code snippets using libcore.net.RawSocket (Showing top 20 results out of 315)

origin: robovm/robovm

  @Override protected void finalize() throws Throwable {
    try {
      if (guard != null) {
        guard.warnIfOpen();
      }
      close();
    } finally {
      super.finalize();
    }
  }
}
origin: robovm/robovm

/**
 * Creates a socket on the specified interface.
 */
public RawSocket(String interfaceName, short protocolType)
  throws SocketException {
  mInterfaceName = interfaceName;
  mProtocolType = protocolType;
  fd = new FileDescriptor();
  create(fd, mProtocolType, mInterfaceName);
  guard.open("close");
}
origin: robovm/robovm

/**
 * Reads a raw packet into the specified buffer, with the
 * specified timeout.  If the destPort is -1, then the IP
 * destination port is not verified, otherwise only packets
 * destined for the specified UDP port are returned.  Returns the
 * length actually read.  No indication of overflow is signaled.
 * The packet data will start at the IP header (EthernetII
 * dest/source/type headers are removed).
 */
public int read(byte[] packet, int offset, int byteCount, int destPort,
  int timeoutMillis) {
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destPort > 65535) {
    throw new IllegalArgumentException("Port out of range: "
      + destPort);
  }
  return recvPacket(fd, packet, offset, byteCount, destPort,
    timeoutMillis);
}
origin: robovm/robovm

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
origin: com.gluonhq/robovm-rt

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
origin: MobiVM/robovm

  @Override protected void finalize() throws Throwable {
    try {
      if (guard != null) {
        guard.warnIfOpen();
      }
      close();
    } finally {
      super.finalize();
    }
  }
}
origin: MobiVM/robovm

/**
 * Creates a socket on the specified interface.
 */
public RawSocket(String interfaceName, short protocolType)
  throws SocketException {
  mInterfaceName = interfaceName;
  mProtocolType = protocolType;
  fd = new FileDescriptor();
  create(fd, mProtocolType, mInterfaceName);
  guard.open("close");
}
origin: MobiVM/robovm

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
origin: com.bugvm/bugvm-rt

/**
 * Reads a raw packet into the specified buffer, with the
 * specified timeout.  If the destPort is -1, then the IP
 * destination port is not verified, otherwise only packets
 * destined for the specified UDP port are returned.  Returns the
 * length actually read.  No indication of overflow is signaled.
 * The packet data will start at the IP header (EthernetII
 * dest/source/type headers are removed).
 */
public int read(byte[] packet, int offset, int byteCount, int destPort,
  int timeoutMillis) {
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destPort > 65535) {
    throw new IllegalArgumentException("Port out of range: "
      + destPort);
  }
  return recvPacket(fd, packet, offset, byteCount, destPort,
    timeoutMillis);
}
origin: com.mobidevelop.robovm/robovm-rt

  @Override protected void finalize() throws Throwable {
    try {
      if (guard != null) {
        guard.warnIfOpen();
      }
      close();
    } finally {
      super.finalize();
    }
  }
}
origin: com.bugvm/bugvm-rt

/**
 * Creates a socket on the specified interface.
 */
public RawSocket(String interfaceName, short protocolType)
  throws SocketException {
  mInterfaceName = interfaceName;
  mProtocolType = protocolType;
  fd = new FileDescriptor();
  create(fd, mProtocolType, mInterfaceName);
  guard.open("close");
}
origin: ibinti/bugvm

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
origin: com.gluonhq/robovm-rt

/**
 * Reads a raw packet into the specified buffer, with the
 * specified timeout.  If the destPort is -1, then the IP
 * destination port is not verified, otherwise only packets
 * destined for the specified UDP port are returned.  Returns the
 * length actually read.  No indication of overflow is signaled.
 * The packet data will start at the IP header (EthernetII
 * dest/source/type headers are removed).
 */
public int read(byte[] packet, int offset, int byteCount, int destPort,
  int timeoutMillis) {
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destPort > 65535) {
    throw new IllegalArgumentException("Port out of range: "
      + destPort);
  }
  return recvPacket(fd, packet, offset, byteCount, destPort,
    timeoutMillis);
}
origin: ibinti/bugvm

  @Override protected void finalize() throws Throwable {
    try {
      if (guard != null) {
        guard.warnIfOpen();
      }
      close();
    } finally {
      super.finalize();
    }
  }
}
origin: ibinti/bugvm

/**
 * Creates a socket on the specified interface.
 */
public RawSocket(String interfaceName, short protocolType)
  throws SocketException {
  mInterfaceName = interfaceName;
  mProtocolType = protocolType;
  fd = new FileDescriptor();
  create(fd, mProtocolType, mInterfaceName);
  guard.open("close");
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
origin: MobiVM/robovm

/**
 * Reads a raw packet into the specified buffer, with the
 * specified timeout.  If the destPort is -1, then the IP
 * destination port is not verified, otherwise only packets
 * destined for the specified UDP port are returned.  Returns the
 * length actually read.  No indication of overflow is signaled.
 * The packet data will start at the IP header (EthernetII
 * dest/source/type headers are removed).
 */
public int read(byte[] packet, int offset, int byteCount, int destPort,
  int timeoutMillis) {
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destPort > 65535) {
    throw new IllegalArgumentException("Port out of range: "
      + destPort);
  }
  return recvPacket(fd, packet, offset, byteCount, destPort,
    timeoutMillis);
}
origin: FlexoVM/flexovm

  @Override protected void finalize() throws Throwable {
    try {
      if (guard != null) {
        guard.warnIfOpen();
      }
      close();
    } finally {
      super.finalize();
    }
  }
}
origin: FlexoVM/flexovm

/**
 * Creates a socket on the specified interface.
 */
public RawSocket(String interfaceName, short protocolType)
  throws SocketException {
  mInterfaceName = interfaceName;
  mProtocolType = protocolType;
  fd = new FileDescriptor();
  create(fd, mProtocolType, mInterfaceName);
  guard.open("close");
}
origin: com.bugvm/bugvm-rt

/**
 * Writes a raw packet to the desired interface.  A L2 header will
 * be added which includes the specified destination address, our
 * source MAC, and the specified protocol type.  The caller is responsible
 * for computing correct IP-header and payload checksums.
 */
public int write(byte[] destMac, byte[] packet, int offset, int byteCount) {
  if (destMac == null) {
    throw new NullPointerException("destMac == null");
  }
  if (packet == null) {
    throw new NullPointerException("packet == null");
  }
  Arrays.checkOffsetAndCount(packet.length, offset, byteCount);
  if (destMac.length != 6) {
    throw new IllegalArgumentException("MAC length must be 6: "
      + destMac.length);
  }
  return sendPacket(fd, mInterfaceName, mProtocolType, destMac, packet,
    offset, byteCount);
}
libcore.netRawSocket

Javadoc

This class allows raw L2 packets to be sent and received via the specified network interface. The receive-side implementation is restricted to UDP packets for efficiency.

Most used methods

  • close
    Closes the socket. After this method is invoked, subsequent read/write operations will fail.
  • create
  • recvPacket
  • sendPacket

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • getContentResolver (Context)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Join (org.hibernate.mapping)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now