Codota Logo
IoBridge.sendto
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
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
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • String (java.lang)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now