Package com.barchart.udt

Examples of com.barchart.udt.SocketUDT


    return new SelectorUDT(this, maxSelectorSize, maxConnectorSize);
  }

  @Override
  public ServerSocketChannel openServerSocketChannel() throws IOException {
    SocketUDT serverSocketUDT = new SocketUDT(type);
    return new ChannelServerSocketUDT(this, serverSocketUDT);
  }
View Full Code Here


    return new ChannelServerSocketUDT(this, serverSocketUDT);
  }

  @Override
  public SocketChannel openSocketChannel() throws IOException {
    SocketUDT socketUDT = new SocketUDT(type);
    return new ChannelSocketUDT(this, socketUDT);
  }
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

        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

      final ReadStrategy readStrategy,
      final AtomicBoolean readyToAccept) throws Exception {

    log.info("STARTED");

    final SocketUDT acceptorSocket = new SocketUDT(TypeUDT.STREAM);

    acceptorSocket.bind(serverAddress);
    assertTrue("Acceptor should be bound", acceptorSocket.isBound());

    acceptorSocket.listen(1);
    assertEquals("Acceptor should be listenin", acceptorSocket.getStatus(),
        StatusUDT.LISTENING);

    readyToAccept.set(true);
    synchronized(readyToAccept) {
      readyToAccept.notifyAll();
    }
    final SocketUDT connectorSocket = acceptorSocket.accept();
    assertTrue(connectorSocket.isBound());
    assertTrue(connectorSocket.isConnected());

    echo(connectorSocket, readStrategy);

  }
View Full Code Here

  protected OutputStream outputStream;

  protected final SocketUDT socketUDT;

  public NetSocketUDT() throws ExceptionUDT {
    this.socketUDT = new SocketUDT(TypeUDT.STREAM);
    this.socketUDT.configureBlocking(true);
  }
View Full Code Here

public class NetServerSocketUDT extends ServerSocket implements IceServerSocket {

  protected final SocketUDT serverSocketUDT;

  public NetServerSocketUDT() throws IOException {
    this.serverSocketUDT = new SocketUDT(TypeUDT.STREAM);
    this.serverSocketUDT.configureBlocking(true);
  }
View Full Code Here

  //

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

    try {

      TypeUDT type = TypeUDT.DATAGRAM;

      SocketUDT socket = new SocketUDT(type);

      ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1024);
      log.info("byteBuffer.isDirect={}", byteBuffer.isDirect());

      socket.testDirectByteBufferAccess0(byteBuffer);
      for (int k = 0; k < 3; k++) {
        byte byteValue = byteBuffer.get(k);
        log.info("k={} byteBuffer[k]={}", k, (char) byteValue);
      }

      //

      IntBuffer intBuffer = ByteBuffer.allocateDirect(1024 * 4).order(
          ByteOrder.nativeOrder()).asIntBuffer();

      log.info("intBuffer.isDirect={}", intBuffer.isDirect());

      for (int k = 0; k < 3; k++) {
        intBuffer.put(k, 0);
      }

      socket.testDirectIntBufferAccess0(intBuffer);
      for (int k = 0; k < 3; k++) {
        int intValue = intBuffer.get(k);
        log.info("k={} intBuffer[k]={}", k, (char) intValue);
      }

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

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.