congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
IoBridge.sendto
Code IndexAdd Tabnine to your IDE (free)

How to use
sendto
method
in
libcore.io.IoBridge

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

origin: robovm/robovm

  /**
   * For PlainSocketOutputStream.
   */
  private void write(byte[] buffer, int offset, int byteCount) throws IOException {
    Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
    if (streaming) {
      while (byteCount > 0) {
        int bytesWritten = IoBridge.sendto(fd, buffer, offset, byteCount, 0, null, 0);
        byteCount -= bytesWritten;
        offset += bytesWritten;
      }
    } else {
      // Unlike writes to a streaming socket, writes to a datagram
      // socket are all-or-nothing, so we don't need a loop here.
      // http://code.google.com/p/android/issues/detail?id=15304

      // RoboVM note: The original code passed this.address here as 
      // destination address. However, on Darwin sendto() fails with 
      // EINVAL if called with a non-null destination address for an 
      // already connected socket (see issue #76). Non-streaming Sockets 
      // are always connected in the constructor so it should be safe to 
      // pass null here instead.
      IoBridge.sendto(fd, buffer, offset, byteCount, 0, null, port);
    }
  }
}
origin: robovm/robovm

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: robovm/robovm

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: robovm/robovm

@Override
public int send(ByteBuffer source, SocketAddress socketAddress) throws IOException {
  checkNotNull(source);
  checkOpen();
  InetSocketAddress isa = (InetSocketAddress) socketAddress;
  if (isa.getAddress() == null) {
    throw new IOException();
  }
  if (isConnected() && !connectAddress.equals(isa)) {
    throw new IllegalArgumentException("Connected to " + connectAddress +
                      ", not " + socketAddress);
  }
  synchronized (writeLock) {
    int sendCount = 0;
    try {
      begin();
      int oldPosition = source.position();
      sendCount = IoBridge.sendto(fd, source, 0, isa.getAddress(), isa.getPort());
      if (sendCount > 0) {
        source.position(oldPosition + sendCount);
      }
      isBound = true;
    } finally {
      end(sendCount >= 0);
    }
    return sendCount;
  }
}
origin: robovm/robovm

private int writeImpl(ByteBuffer src) throws IOException {
  synchronized (writeLock) {
    if (!src.hasRemaining()) {
      return 0;
    }
    int writeCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      writeCount = IoBridge.sendto(fd, src, 0, null, 0);
      if (writeCount > 0) {
        src.position(src.position() + writeCount);
      }
    } finally {
      if (isBlocking()) {
        end(writeCount >= 0);
      }
    }
    return writeCount;
  }
}
origin: MobiVM/robovm

  /**
   * For PlainSocketOutputStream.
   */
  private void write(byte[] buffer, int offset, int byteCount) throws IOException {
    Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
    if (streaming) {
      while (byteCount > 0) {
        int bytesWritten = IoBridge.sendto(fd, buffer, offset, byteCount, 0, null, 0);
        byteCount -= bytesWritten;
        offset += bytesWritten;
      }
    } else {
      // Unlike writes to a streaming socket, writes to a datagram
      // socket are all-or-nothing, so we don't need a loop here.
      // http://code.google.com/p/android/issues/detail?id=15304

      // RoboVM note: The original code passed this.address here as 
      // destination address. However, on Darwin sendto() fails with 
      // EINVAL if called with a non-null destination address for an 
      // already connected socket (see issue #76). Non-streaming Sockets 
      // are always connected in the constructor so it should be safe to 
      // pass null here instead.
      IoBridge.sendto(fd, buffer, offset, byteCount, 0, null, port);
    }
  }
}
origin: com.mobidevelop.robovm/robovm-rt

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: MobiVM/robovm

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: com.bugvm/bugvm-rt

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: com.gluonhq/robovm-rt

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: ibinti/bugvm

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: FlexoVM/flexovm

@Override
public void send(DatagramPacket packet) throws IOException {
  int port = isNativeConnected ? 0 : packet.getPort();
  InetAddress address = isNativeConnected ? null : packet.getAddress();
  IoBridge.sendto(fd, packet.getData(), packet.getOffset(), packet.getLength(), 0, address, port);
}
origin: MobiVM/robovm

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: ibinti/bugvm

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: FlexoVM/flexovm

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: com.gluonhq/robovm-rt

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: com.mobidevelop.robovm/robovm-rt

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: com.bugvm/bugvm-rt

private int writeImpl(ByteBuffer buf) throws IOException {
  synchronized (writeLock) {
    int result = 0;
    try {
      begin();
      result = IoBridge.sendto(fd, buf, 0, null, 0);
    } finally {
      end(result > 0);
    }
    return result;
  }
}
origin: MobiVM/robovm

private int writeImpl(ByteBuffer src) throws IOException {
  synchronized (writeLock) {
    if (!src.hasRemaining()) {
      return 0;
    }
    int writeCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      writeCount = IoBridge.sendto(fd, src, 0, null, 0);
      if (writeCount > 0) {
        src.position(src.position() + writeCount);
      }
    } finally {
      if (isBlocking()) {
        end(writeCount >= 0);
      }
    }
    return writeCount;
  }
}
origin: com.mobidevelop.robovm/robovm-rt

private int writeImpl(ByteBuffer src) throws IOException {
  synchronized (writeLock) {
    if (!src.hasRemaining()) {
      return 0;
    }
    int writeCount = 0;
    try {
      if (isBlocking()) {
        begin();
      }
      writeCount = IoBridge.sendto(fd, src, 0, null, 0);
      if (writeCount > 0) {
        src.position(src.position() + writeCount);
      }
    } finally {
      if (isBlocking()) {
        end(writeCount >= 0);
      }
    }
    return writeCount;
  }
}
libcore.ioIoBridgesendto

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,
  • recvfrom

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ImageIO (javax.imageio)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JFileChooser (javax.swing)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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