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

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JComboBox (javax.swing)
  • Best IntelliJ 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