Package com.barchart.udt

Examples of com.barchart.udt.SocketUDT


        throw new IllegalSelectorException();
      }

      ChannelUDT channelUDT = (ChannelUDT) channel;

      SocketUDT socketUDT = channelUDT.getSocketUDT();

      SelectionKeyUDT keyUDT = new SelectionKeyUDT(//
          this, channelUDT, attachment, interestOps);

      // XXX the only place with "add/put"
      registeredKeyMap.put(socketUDT.getSocketId(), keyUDT);
      registeredKeySet.add(keyUDT);

      return keyUDT;

    }
View Full Code Here


        throw new IllegalSelectorException();
      }

      ChannelUDT channelUDT = (ChannelUDT) channel;

      SocketUDT socketUDT = channelUDT.getSocketUDT();

      SelectionKeyUDT keyUDT = new SelectionKeyUDT(//
          this, channelUDT, attachment, interestOps);

      // XXX the only place with "add/put"
      registeredKeyMap.put(socketUDT.getSocketId(), keyUDT);
      registeredKeySet.add(keyUDT);

      return keyUDT;

    }
View Full Code Here

    try {

      TypeUDT type = TypeUDT.STREAM;

      SocketUDT socket = new SocketUDT(type);

      // this will kill the jvm
      socket.testCrashJVM0();

    } catch (Throwable e) {
      log.error("unexpected", e);
    }
View Full Code Here

            apply(channelUDT);
        }
    }

    protected void apply(final ChannelUDT channelUDT) throws IOException {
        final SocketUDT socketUDT = channelUDT.socketUDT();
        socketUDT.setReuseAddress(isReuseAddress());
        socketUDT.setSendBufferSize(getSendBufferSize());
        if (getSoLinger() <= 0) {
            socketUDT.setSoLinger(false, 0);
        } else {
            socketUDT.setSoLinger(true, getSoLinger());
        }
        socketUDT.setOption(OptionUDT.Protocol_Receive_Buffer_Size,
                getProtocolReceiveBufferSize());
        socketUDT.setOption(OptionUDT.Protocol_Send_Buffer_Size,
                getProtocolSendBufferSize());
        socketUDT.setOption(OptionUDT.System_Receive_Buffer_Size,
                getSystemReceiveBufferSize());
        socketUDT.setOption(OptionUDT.System_Send_Buffer_Size,
                getSystemSendBufferSize());
    }
View Full Code Here

    logClassPath();

    try {

      final SocketUDT socket = new SocketUDT(TypeUDT.DATAGRAM);

      log.info("made socketID={}", socket.getSocketId());

      log.info("socket status={}", socket.getStatus());

      log.info("socket isOpen={}", socket.isOpen());

      log.info("socket isBlocking={}", socket.isBlocking());

      log.info("socket options{}", socket.toStringOptions());

    } catch (Throwable e) {

      log.error("can not make socket", e);
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 NetSocketUDT() throws ExceptionUDT {
    this(new SocketUDT(TypeUDT.STREAM));
    this.socketUDT.setBlocking(true);
  }
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

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.