Package com.barchart.udt

Examples of com.barchart.udt.SocketUDT


  public SocketChannelUDT accept() throws IOException {
    try {

      begin();

      final SocketUDT clientUDT = socketUDT.accept();

      if (clientUDT == null) {

        return null;

      } else {

        return new SocketChannelUDT( //
            providerUDT(), //
            clientUDT, //
            clientUDT.isConnected() //
        );

      }
    } finally {
      end(true);
View Full Code Here


    if (remaining <= 0) {
      return 0;
    }

    final SocketUDT socket = socketUDT;
    final boolean isBlocking = isBlockingMode;

    final int sizeReceived;

    try {

      if (isBlocking) {
        begin(); // JDK contract for NIO blocking calls
      }

      if (buffer.isDirect()) {

        sizeReceived = socket.receive(buffer);

      } else {

        final byte[] array = buffer.array();
        final int position = buffer.position();
        final int limit = buffer.limit();

        sizeReceived = socket.receive(array, position, limit);

        if (0 < sizeReceived && sizeReceived <= remaining) {
          buffer.position(position + sizeReceived);
        }
View Full Code Here

    if (remaining <= 0) {
      return 0;
    }

    final SocketUDT socket = socketUDT;
    final boolean isBlocking = isBlockingMode;

    int sizeSent = 0;
    int ret = 0;

    try {

      if (isBlocking) {
        begin(); // JDK contract for NIO blocking calls
      }

      if (buffer.isDirect()) {

        do {
          ret = socket.send(buffer);

          if (ret > 0)
            sizeSent += ret;

        } while (buffer.hasRemaining() && isBlocking);

      } else {

        final byte[] array = buffer.array();
        int position = buffer.position();
        final int limit = buffer.limit();

        do {
          ret = socket.send(array, position, limit);

          if (0 < ret && ret <= remaining) {
            sizeSent += ret;
            position += ret;
            buffer.position(position);
View Full Code Here

  protected final SocketUDT socketUDT;

  /** uses {@link TypeUDT#STREAM} socket in blocking mode */
  public NetServerSocketUDT() throws IOException {
    this(new SocketUDT(TypeUDT.STREAM));
    this.socketUDT.setBlocking(true);
  }
View Full Code Here

    this.socketUDT = socketUDT;
  }

  @Override
  public Socket accept() throws IOException {
    final SocketUDT clientUDT = socketUDT.accept();
    return new NetSocketUDT(clientUDT);
  }
View Full Code Here

    if (remaining <= 0) {
      return 0;
    }

    final SocketUDT socket = socketUDT;
    final boolean isBlocking = isBlockingMode;

    final int sizeReceived;

    try {

      if (isBlocking) {
        begin(); // JDK contract for NIO blocking calls
      }

      if (buffer.isDirect()) {

        sizeReceived = socket.receive(buffer);

      } else {

        final byte[] array = buffer.array();
        final int position = buffer.position();
        final int limit = buffer.limit();

        sizeReceived = socket.receive(array, position, limit);

        if (0 < sizeReceived && sizeReceived <= remaining) {
          buffer.position(position + sizeReceived);
        }
View Full Code Here

    if (remaining <= 0) {
      return 0;
    }

    final SocketUDT socket = socketUDT;
    final boolean isBlocking = isBlockingMode;

    final int sizeSent;

    try {

      if (isBlocking) {
        begin(); // JDK contract for NIO blocking calls
      }

      if (buffer.isDirect()) {

        sizeSent = socket.send(buffer);

      } else {

        final byte[] array = buffer.array();
        final int position = buffer.position();
        final int limit = buffer.limit();

        sizeSent = socket.send(array, position, limit);

        if (0 < sizeSent && sizeSent <= remaining) {
          buffer.position(position + sizeSent);
        }
      }
View Full Code Here

  protected final SocketUDT socketUDT;

  /** uses {@link TypeUDT#STREAM} socket in blocking mode */
  public NetSocketUDT() throws ExceptionUDT {
    this(new SocketUDT(TypeUDT.STREAM));
    this.socketUDT.setBlocking(true);
  }
View Full Code Here

   * Open UDT {@link KindUDT#RENDEZVOUS} socket channel.
   *
   * @see {@link RendezvousChannelUDT}
   */
  public RendezvousChannelUDT openRendezvousChannel() throws IOException {
    final SocketUDT socketUDT = new SocketUDT(type);
    return new RendezvousChannelUDT(this, socketUDT);
  }
View Full Code Here

   *
   * @see {@link ServerSocketChannelUDT}
   */
  @Override
  public ServerSocketChannelUDT openServerSocketChannel() throws IOException {
    final SocketUDT serverSocketUDT = new SocketUDT(type);
    return new ServerSocketChannelUDT(this, serverSocketUDT);
  }
View Full Code Here

TOP

Related Classes of com.barchart.udt.SocketUDT

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.