Tabnine Logo
IoBridge.recvfrom
Code IndexAdd Tabnine to your IDE (free)

How to use
recvfrom
method
in
libcore.io.IoBridge

Best Java code snippets using libcore.io.IoBridge.recvfrom (Showing top 20 results out of 315)

origin: robovm/robovm

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: robovm/robovm

/**
 * For PlainSocketInputStream.
 */
private int read(byte[] buffer, int offset, int byteCount) throws IOException {
  if (byteCount == 0) {
    return 0;
  }
  Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
  if (shutdownInput) {
    return -1;
  }
  int readCount = IoBridge.recvfrom(true, fd, buffer, offset, byteCount, 0, null, false);
  // Return of zero bytes for a blocking socket means a timeout occurred
  if (readCount == 0) {
    throw new SocketTimeoutException();
  }
  // Return of -1 indicates the peer was closed
  if (readCount == -1) {
    shutdownInput = true;
  }
  return readCount;
}
origin: robovm/robovm

private SocketAddress receiveDirectImpl(ByteBuffer target, boolean loop) throws IOException {
  SocketAddress retAddr = null;
  DatagramPacket receivePacket = new DatagramPacket(EmptyArray.BYTE, 0);
  int oldposition = target.position();
  int received = 0;
  do {
    received = IoBridge.recvfrom(false, fd, target, 0, receivePacket, isConnected());
    if (receivePacket != null && receivePacket.getAddress() != null) {
      // copy the data of received packet
      if (received > 0) {
        target.position(oldposition + received);
      }
      retAddr = receivePacket.getSocketAddress();
      break;
    }
  } while (loop);
  return retAddr;
}
origin: robovm/robovm

private SocketAddress receiveImpl(ByteBuffer target, boolean loop) throws IOException {
  SocketAddress retAddr = null;
  DatagramPacket receivePacket;
  int oldposition = target.position();
  int received = 0;
  // TODO: disallow mapped buffers and lose this conditional?
  if (target.hasArray()) {
    receivePacket = new DatagramPacket(target.array(), target.position() + target.arrayOffset(), target.remaining());
  } else {
    receivePacket = new DatagramPacket(new byte[target.remaining()], target.remaining());
  }
  do {
    received = IoBridge.recvfrom(false, fd, receivePacket.getData(), receivePacket.getOffset(), receivePacket.getLength(), 0, receivePacket, isConnected());
    if (receivePacket != null && receivePacket.getAddress() != null) {
      if (received > 0) {
        if (target.hasArray()) {
          target.position(oldposition + received);
        } else {
          // copy the data of received packet
          target.put(receivePacket.getData(), 0, received);
        }
      }
      retAddr = receivePacket.getSocketAddress();
      break;
    }
  } while (loop);
  return retAddr;
}
origin: robovm/robovm

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      readCount = IoBridge.recvfrom(true, fd, dst, 0, null, false);
      if (readCount > 0) {
        dst.position(dst.position() + readCount);
      }
    } finally {
      if (isBlocking()) {
        end(readCount > 0);
      }
    }
    return readCount;
  }
}
origin: robovm/robovm

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
origin: MobiVM/robovm

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: com.mobidevelop.robovm/robovm-rt

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: com.gluonhq/robovm-rt

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: ibinti/bugvm

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: com.bugvm/bugvm-rt

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: ibinti/bugvm

private SocketAddress receiveDirectImpl(ByteBuffer target, boolean loop) throws IOException {
  SocketAddress retAddr = null;
  DatagramPacket receivePacket = new DatagramPacket(EmptyArray.BYTE, 0);
  int oldposition = target.position();
  int received = 0;
  do {
    received = IoBridge.recvfrom(false, fd, target, 0, receivePacket, isConnected());
    if (receivePacket != null && receivePacket.getAddress() != null) {
      // copy the data of received packet
      if (received > 0) {
        target.position(oldposition + received);
      }
      retAddr = receivePacket.getSocketAddress();
      break;
    }
  } while (loop);
  return retAddr;
}
origin: FlexoVM/flexovm

private void doRecv(DatagramPacket pack, int flags) throws IOException {
  IoBridge.recvfrom(false, fd, pack.getData(), pack.getOffset(), pack.getLength(), flags, pack, isNativeConnected);
  if (isNativeConnected) {
    updatePacketRecvAddress(pack);
  }
}
origin: ibinti/bugvm

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      readCount = IoBridge.recvfrom(true, fd, dst, 0, null, false);
      if (readCount > 0) {
        dst.position(dst.position() + readCount);
      }
    } finally {
      if (isBlocking()) {
        end(readCount > 0);
      }
    }
    return readCount;
  }
}
origin: com.mobidevelop.robovm/robovm-rt

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      readCount = IoBridge.recvfrom(true, fd, dst, 0, null, false);
      if (readCount > 0) {
        dst.position(dst.position() + readCount);
      }
    } finally {
      if (isBlocking()) {
        end(readCount > 0);
      }
    }
    return readCount;
  }
}
origin: ibinti/bugvm

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
origin: MobiVM/robovm

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
origin: com.mobidevelop.robovm/robovm-rt

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
origin: com.bugvm/bugvm-rt

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
origin: com.gluonhq/robovm-rt

private int readImpl(ByteBuffer dst) throws IOException {
  synchronized (readLock) {
    int readCount = 0;
    try {
      begin();
      readCount = IoBridge.recvfrom(false, fd, dst, 0, null, isConnected());
    } catch (InterruptedIOException e) {
      // InterruptedIOException will be thrown when timeout.
      return 0;
    } finally {
      end(readCount > 0);
    }
    return readCount;
  }
}
libcore.ioIoBridgerecvfrom

Popular methods of IoBridge

  • available
  • bind
  • booleanFromInt
  • booleanToInt
  • closeSocket
  • connect
    Connects socket 'fd' to 'inetAddress' on 'port', with a the given 'timeoutMs'. Use timeoutMs == 0 fo
  • connectDetail
  • connectErrno
  • getSocketLocalAddress
  • getSocketLocalPort
  • getSocketOption
    java.net has its own socket options similar to the underlying Unix ones. We paper over the differenc
  • getSocketOptionErrno
  • getSocketOption,
  • getSocketOptionErrno,
  • isConnected,
  • maybeThrowAfterRecvfrom,
  • maybeThrowAfterSendto,
  • open,
  • postRecvfrom,
  • read,
  • sendto

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • getSystemService (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 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