Multicast with NIO

Hello,
I searched the web for some time now, and got the impression that multicast support for NIO is not possible.
I was woner if it's possible to implement a SelectorProvider, and provide the openSelector, openDatagramChannel etc', and then implement the inheritedChannel() method. for that I need an implementation for SelectorImpl, DatagramChannelImpl, SocketChannelImpl etc'.
Did anybody ever done a thing like that? Or has a code for that purpose?
thanks
Udi

Wait for 1.7. It's coming.

Similar Messages

  • [svn] 1720: Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints .

    Revision: 1720
    Author: [email protected]
    Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
    Log Message:
    Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
    QA: Yes
    Doc: No
    Details:
    Update to the TomcatLoginCommand to work correctly with NIO endpoints.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-304
    Modified Paths:
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

    Revision: 1720
    Author: [email protected]
    Date: 2008-05-14 14:50:06 -0700 (Wed, 14 May 2008)
    Log Message:
    Bugs: LCDS-304 - Authentication not working in all cases when using security constraint with NIO endpoints.
    QA: Yes
    Doc: No
    Details:
    Update to the TomcatLoginCommand to work correctly with NIO endpoints.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-304
    Modified Paths:
    blazeds/branches/3.0.x/modules/opt/src/tomcat/flex/messaging/security/TomcatLoginCommand. java

  • [svn:bz-trunk] 16395: Bug: #2621264 [Regression] Small messages not working with NIO-HTTP endpoints in LCSD/trunk.

    Revision: 16395
    Revision: 16395
    Author:   [email protected]
    Date:     2010-06-02 05:00:56 -0700 (Wed, 02 Jun 2010)
    Log Message:
    Bug: #2621264 Small messages not working with NIO-HTTP endpoints in LCSD/trunk.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This is the BlazeDS side of the fix. This wasn't a regression, it probably never worked correctly. So, in the scenario where there's a Producer and a Consumer, and Producer sends a message for the Consumer, there are 2 messages from the server. The ACK message for Producer's send, and the actual message Consumer receives. I found that the ACK message was in small form, but the actual message was not in streaming messages. This was because we never really tried to convert streamed messages into small messages before.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/StreamingAMFEndpoint.java
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/StreamingHTTPEndpoint.java

  • Multicasting with an SGE2010P

    Hi,
    I have just purchased a SGE2010p switch. I am hoping to multicast with windows deployment services WDS
    and also hoping someone might be able to give a basic explanation (configuration would be brilliant!) on the process.
    On the switch webpage, we ticked the box for IGMP snooping. WDS configured with multicasting and that part of
    it works. Getting transfer rates of 16,000KBps (according to WDS console). Would have thought gigabyte should be
    better than that, but still better than the 250KBps without IGMP snooping.
    The problem is that all traffic is still being sent to all other ports on the switch. There is only the switch
    and no routers involved. Some documents indicate IGMP querier is required, but there seems no option for that that
    I can find. I believe we later enabled autolearn (but not certain - dont have access to the switch at the moment)
    and then WDS broke <again>.
    So I am hoping someone can please educate me!
    What needs to be done to prevent the switch from forwarding data to all ports
    Is AutoLearn the same as an IGMP querier?
    What is bridge multicast forwarding? Sounds like passing multicasts across routers?.
    Do we need to create a multicast group on the switch? I would think no, that WDS does all that.
    Does this switch support MLD snooping?
    Any help appreciated
    thank you!

    That's not going to work; manually defining groups means static multicasting (ie not dynamic nor scalable). That sort of defeats the purpose of IGMP snooping.
    The problem is Microsoft's default multicast range is incompatible with IGMP and switches.
    When a multicast layer 3 address is mapped to layer 2 (for the switch multicast layer 2 address), only the last 23 bits of the IPv4 address come across. The other bits are lost as we need specify the ethernet OUID owned by iana.  (01-00-5e).
    So the default range by microsoft 239.0.0.1-239.0.0.255 maps out at the ethernet layer:  01-00-5e-00-00-01 to 01-00-5e-00-00-ff
    The problem is, the 224.x.x.x mulicast control messages also map out like that, e.g. 224.0.0.1 maps to 01-00-5e-00-00-01.
    So 224.0.0.1 and 239.0.0.1 map to the same ethernet (layer 2) mac address. Therefore the switch has no alternative but to broadcast as 224.0.0.1 = all nodes.
    So try changing the default WDS address to something that wont get confused by the switch, e.g. 239.67.54.3 to 239.67.54.255.
    Have tested this in a lab only but should fix the problem.
    bye
    Oh, bridge multicast forwarding is for when the traffic needs to be forwarded (ie to another switch or router). Filtering is only to be touched to block all multicast traffic - perhaps for permanent groups that need to be manually configured. You dont need to touch that.

  • Help with NIO and SSL

    hi,
    anyone have code for SSL with NIO.
    Thanks

    You could start by searching this very forum for 'SSLEngine', & try Google too. Also have a look in your JDK samples.

  • How can i use GZip combined with NIO?

    Hi All,
    I have a nio client that connects a client (HTTP) and request something. I need my client to Accept-Encoding: gzip - but how will i be able to read the data into my ByteBuffer?
    I don't have a problem reading, cause it's bytes after all, but i will have a problem (i guess) determining when the reading is complete - when it finished. If i'm reading HTTP, for instance, i know i should finish reading after receiving \r\n\r\n. How should i do it for gzip info?
    Thanks,
    Snayit

    When i'm reading the HTTP i receive Content-Length X but actualy is sends the X with Y bytes (i guess it's a key, about to check in the API).
    Is there a way to combine the GZip with NIO?

  • Selector thread in JSSE with NIO works nor parallely?

    Hi,
    I am now studying JSSE with NIO. Most of the codes are that I looked, used the Selectable Non blocking IO model. Selector thread contains many keys(keys == client sockets nearly)
    The Selector object maintains a set of selected keys and just one key is processed at a given time in a server program. So, there is no parallel work. I wonder why this keys are not processed parallely, not in batch process model in one thread?

    wow, this reply enlightens me.I have a question for you.
    here is a samle run method of runnable selector class.
    public void run() {
        while (true) {
          doPendingTasks();
          if (closeRequested) {
            return;
          int selectedKeys = 0;
          try {
            selectedKeys = selector.select();
          } catch (IOException ioe) {      
            ioe.printStackTrace();
            continue;
          if (selectedKeys == 0) {
            continue;
          Iterator it = selector.selectedKeys().iterator();
          while (it.hasNext()) {
            SelectionKey sk = (SelectionKey)it.next();
            it.remove();
            try {
              int readyOps = sk.readyOps();
              sk.interestOps(sk.interestOps() & ~readyOps);
              SelectorHandler handler =
                 (SelectorHandler) sk.attachment();         
              if (sk.isAcceptable()) {
                ((AcceptSelectorHandler)handler).handleAccept();
              } else if (sk.isConnectable()) {     
                ((ConnectorSelectorHandler)handler).handleConnect();           
              } else {
                ReadWriteSelectorHandler rwHandler =
                  (ReadWriteSelectorHandler)handler;              
                if (sk.isReadable()) {               
                  rwHandler.handleRead();             
                if (sk.isValid() && sk.isWritable()) {
                  rwHandler.handleWrite();                             
            } catch (Throwable t) {
              Shutdown();
              t.printStackTrace();
              return;
      }in this code every operation is managed by handler named "handleXXX".for example "handleRead" does reading job and also informs the side(client or server) for the data read.
    public void handleRead() {
        try {     
          int readBytes = channel.read(inBuffer);     
          if (readBytes == -1) {
            // Closing channel...
            close();
            side.socketDisconnected(this);
            return;
          inBuffer.flip();
          processInBuffer(); //if there is parts that belongs to more than one packet, seperate them and inform side(client/server)
        } catch (IOException ex) {
          side.socketException(this, ex);
          close();
      }Finally my question is if this approach is wrong.if not ,it takes more than zero time,doesn't it?
    If it is wrong , what approach do you suggest about handling operations?
    Thanks.

  • Experience with NIO client servers

    Dear Forum
    I am going to build a xml socket server and would like to use NIO rather than multi threadeding.
    What the server will do is accept client connections and run them on their own thread, these clients will then be able to send/recieve data in xml and also make simple queries to a mysql database.
    I have developed a similar system using conventional thread methods but not with NIO, the main problem that I have is i cannot see an example where a client connects a new thread is started for that client and then its reference is stored on the server allowing messages to be sent by iterating through the client vector. Is this the same for NIO?
    Any suggestions or pearls of wisdom would be great..
    Thankyou..

    If your application is basically multithreaded you are better off using the stream based sockets. If you insist on using NIO, I've posted information on multiple threads and NIO in Taming the NIO Circus. You biggest problems will come from the fact that interestOps and register block if a select is active. This forces you do do those all from the thread that does the select. You need to use a queue. Also NIO doesn't support SSL at present, maybe in 1.5.

  • Wierdness with NIO socket on Solaris 2.10 part I

    i tried the following NioClient and MockServer, and saw some weird behavior.
    1. If i run both the client and server on the same machine on Windows, the client connects to the server, queries the instrument and gets the list of instruments back.
    2. if i run both client and server on the same Solaris 2.10 box, the NioClient doesn't get anything back from the MockServer, not even an ACCEPT
    3. if i run the client and the server on different solaris 2.10 machines, they work fine.
    have anyone seen this before? can sometone sheds some lights?
    import java.net.*;
    import java.io.*;
    public class MockServer
         public static int counter = 2;
        public static void main(String[] args) throws IOException {
             int portNumber = Integer.parseInt(args[0]);
            ServerSocket serverSocket = null;
            try {
                serverSocket = new ServerSocket(portNumber);
            } catch (IOException e) {
                System.err.println("Could not listen on port: " + portNumber);
                System.exit(1);
             System.out.println ("Listening on socket " + portNumber);
            do {             
                 Socket clientSocket = null;
                 try {
                     clientSocket = serverSocket.accept();
                     System.out.println ("starting a new client....");
                     MyThread mt = new MyThread (clientSocket);
                     mt.run ();
                 } catch (IOException e) {
                     System.err.println("Accept failed.");
                     System.exit(1);
            while (true);
    class MyThread
         private final Socket clientSocket;
         MyThread (Socket clientSocket)
              this.clientSocket = clientSocket;
         public void run ()
            new Thread (new Runnable () {
                     public void run ()
                          try
                               boolean instrumentquery = false;
                               PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
                               BufferedReader in = new BufferedReader(
                                           new InputStreamReader(
                                           clientSocket.getInputStream()));
                               String inputLine;                          
                               String successoutputLine =
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><return><returncode>success</returncode><detail>everything is good</detail></return>";
                               String failoutputLine =
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><return><returncode>failure</returncode><detail>something is not good</detail></return>";
                               String instrumentsoutput =
                                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><instruments><instrument><contract>usg-505Y</contract><cusip>12131121</cusip><deactivated>false</deactivated><halted>false</halted></instrument><instrument><contract>usg-305Y</contract><cusip>121312342</cusip><deactivated>false</deactivated><halted>false</halted></instrument></instruments>";
                               while ((inputLine = in.readLine()) != null) {
                                    System.out.println ("Receiving the following" + inputLine);
                                    if (inputLine.contains("queryInstrument")) instrumentquery = true;
                                    if (inputLine.contains("</a>"))
                                         if (instrumentquery)
                                              instrumentquery = false;
                                              System.out.println ("Sending " + instrumentsoutput);
                                              out.println (instrumentsoutput);
                                         else
                                              if ((MockServer.counter % 2) == 0)
                                                   System.out.println ("Sending " + successoutputLine);
                                                   out.println(successoutputLine);
                                              else
                                                   System.out.println ("Sending " + failoutputLine);
                                                   out.println(failoutputLine);
                                              MockServer.counter++;
                               out.close();
                               in.close();
                               clientSocket.close();}
                          catch (Exception ex)
                 }).start (); }
    }please see topic "wierdness with NIO socket on Solaris 2.10 part II" for the NioClient code as the maximum per topic is 5000.

    code for NioClient.java
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.InetSocketAddress;
    import java.net.Socket;
    import java.nio.ByteBuffer;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.SocketChannel;
    import java.nio.channels.spi.SelectorProvider;
    import java.util.*;
    public class NioClient implements Runnable {
    private InetAddress hostAddress;
    private int port;
    private Selector selector;
    private ByteBuffer readBuffer = ByteBuffer.allocate(8192);
    private List pendingChanges = new LinkedList();
    private Map pendingData = new HashMap();
    private Map rspHandlers = Collections.synchronizedMap(new HashMap());
    public NioClient(InetAddress hostAddress, int port) throws IOException {
    this.hostAddress = hostAddress;
    this.port = port;
    this.selector = this.initSelector();
    public void send(byte[] data, RspHandler handler) throws IOException {
    SocketChannel socket = this.initiateConnection();
    this.rspHandlers.put(socket, handler);
    synchronized (this.pendingData) {
    List queue = (List) this.pendingData.get(socket);
    if (queue == null) {
    queue = new ArrayList();
    this.pendingData.put(socket, queue);
    queue.add(ByteBuffer.wrap(data));
    this.selector.wakeup();
    public void run() {
    while (true) {
    try {
    synchronized (this.pendingChanges) {
    Iterator changes = this.pendingChanges.iterator();
    while (changes.hasNext()) {
    ChangeRequest change = (ChangeRequest) changes.next();
    switch (change.type) {
    case ChangeRequest.CHANGEOPS:
    SelectionKey key = change.socket
    .keyFor(this.selector);
    key.interestOps(change.ops);
    break;
    case ChangeRequest.REGISTER:
    change.socket.register(this.selector, change.ops);
    break;
    this.pendingChanges.clear();
    this.selector.select();
    Iterator selectedKeys = this.selector.selectedKeys().iterator();
    while (selectedKeys.hasNext()) {
    SelectionKey key = (SelectionKey) selectedKeys.next();
    selectedKeys.remove();
    if (!key.isValid()) {
    continue;
    if (key.isConnectable()) {
    this.finishConnection(key);
    } else if (key.isReadable()) {
    this.read(key);
    } else if (key.isWritable()) {
    this.write(key);
    } catch (Exception e) {
    e.printStackTrace();
    private void read(SelectionKey key) throws IOException {
    SocketChannel socketChannel = (SocketChannel) key.channel();
    this.readBuffer.clear();
    int numRead;
    try {
    numRead = socketChannel.read(this.readBuffer);
    } catch (IOException e) {
    key.cancel();
    socketChannel.close();
    return;
    if (numRead == -1) {
    key.channel().close();
    key.cancel();
    return;
    this.handleResponse(socketChannel, this.readBuffer.array(), numRead);
    private void handleResponse(SocketChannel socketChannel, byte[] data,
    int numRead) throws IOException {
    byte[] rspData = new byte[numRead];
    System.arraycopy(data, 0, rspData, 0, numRead);
    RspHandler handler = (RspHandler) this.rspHandlers.get(socketChannel);
    if (handler.handleResponse(rspData)) {
    socketChannel.close();
    socketChannel.keyFor(this.selector).cancel();
    private void write(SelectionKey key) throws IOException {
    SocketChannel socketChannel = (SocketChannel) key.channel();
    synchronized (this.pendingData) {
    List queue = (List) this.pendingData.get(socketChannel);
    while (!queue.isEmpty()) {
    ByteBuffer buf = (ByteBuffer) queue.get(0);
    socketChannel.write(buf);
    if (buf.remaining() > 0) {
    break;
    queue.remove(0);
    if (queue.isEmpty()) {
    key.interestOps(SelectionKey.OP_READ);
    private void finishConnection(SelectionKey key) throws IOException {
    SocketChannel socketChannel = (SocketChannel) key.channel();
    try {
    socketChannel.finishConnect();
    } catch (IOException e) {
    System.out.println(e);
    key.cancel();
    return;
    key.interestOps(SelectionKey.OP_WRITE);
    private SocketChannel initiateConnection() throws IOException {
    SocketChannel socketChannel = SocketChannel.open();
    socketChannel.configureBlocking(false);
    socketChannel
    .connect(new InetSocketAddress(this.hostAddress, this.port));
    synchronized (this.pendingChanges) {
    this.pendingChanges.add(new ChangeRequest(socketChannel,
    ChangeRequest.REGISTER, SelectionKey.OP_CONNECT));
    return socketChannel;
    private Selector initSelector() throws IOException {
    return SelectorProvider.provider().openSelector();
    public static void main(String[] args) {
    try {
    System.out.println ("the host name is " + args[0]);
    NioClient client = new NioClient(
    InetAddress.getByName(args[0]), 4444);
    Thread t = new Thread(client);
    t.setDaemon(true);
    t.start();
    RspHandler handler = new RspHandler();
    client.send(
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><queryInstrument/></a>\n"
    .getBytes(), handler);
    handler.waitForResponse();
    } catch (Exception e) {
    e.printStackTrace();
    }

  • Mysterious Teardown Problem with NIO

    I have an NIO proxy server which relays state information from a number of servers to a number of clients. A requirement for this system is that we can restart the proxy server (together with a couple of other components) from a web app.
    I tear down the proxy server by
    - interrupting out of the read loop
    - cancelling all keys associated with the channel
    - closing the socket on the channel
    - closing the channel.
    I do this for for both the input (server side) channel and the output (client side) channel.
    I then discard the proxy server, create a new one and start it up.
    Now here's the mysterious bit. The new server operates just fine for a minute or two. And then it stops seeing any input.
    The thread responsible for input reading freezes on the call to -
    myKeysAdded = myAcceptKey.selector().select();and the stack looks something like this:
    WindowsSelectorImpl$SubSelector.poll0(long, int, int[], int[], int[], long)
    WindowsSelectorImpl$SubSelector.poll() line: 270
    WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl$SubSelector) line: 252
    WindowsSelectorImpl.doSelect(long) line: 133
    WindowsSelectorImpl(SelectorImpl).lockAndDoSelect(long) line: 69
    WindowsSelectorImpl(SelectorImpl).select(long) line: 80
    WindowsSelectorImpl(SelectorImpl).select() line: 84
    ProxyServer$BrowserSelector.run() line: 123If I completely destroy the process (and the jvm) and start a new one everything goes back to working normally.
    Has anyone got any suggestions? I'm in hair-tearing mode on this one.
    Thx TOTW.

    I tear down the proxy server by
    - interrupting out of the read loopDon't you mean the select() loop?
    - cancelling all keys associated with the channelUnnecessary.
    - closing the socket on the channel
    - closing the channel.Only one of these is necessary. Closing the socket closes the channel and vice versa.
    When you have closed all the channels, you then need to call selector.selectNow() (search this forum for why), and then close the selector.

  • Synchronous IO with nio

    Hello,
    I have been programming in Java for a while but today is my first shot at NIO.
    I'm implementing a custom protocol over TCP between a java server and several Java and C clients. The classical one-thread-per-client approach works with a couple of test connections, but I'm afraid it will not scale:
    - I will not have control on all clients programs
    - I don't know yet the expected traffic
    - I might introduce bugs as well in the sever program and leak sockets and threads
    Here is the code for the classical approach:
    ServerSocket server.accept()  = ...;
    Socket client = server.accept();
    Thread clientThread = new ClientThread(client);
    clientThread.start();Where ClientThread's run method deos the following:
    BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
    while (isConnected) {
        String pdu = reader.readLine();
        storeClientInfo(pdu);
    }The key is that in order to make for a very simple protocol we designed it so that each PDU is one line of text, sent over TCP. Reading one PDU is therefiore a synchronous operation.
    In order to provision scaling to many clients, we are trying to reimplement it using NIO.
    We use a Selector to wait for requests, and once accepted, we register the Selector with the created SocketChannel (one per client).
    One single thread dequeues reads selected by the Selector, but we are still trying to read using the synchronous BufferredReader.
    When a SocketChannel has readable data, we create a Buffered reader like this:
    BufferedReader reader = new BufferedReader(new InputStreamReader(socketChannel.socket().getInputStream()));
    String pdu = reader.readLine(); //  throws IllegalBlockingModeException
    }And as you probably expect, we get an IllegalBlockingModeException when reading the line (synchronous operation) over the (asynchronous) socket.
    If my understanding is correct, the SocketChannel has to be put in non-blocking mode to be selectable by the Selector (otherwise the register(...) call throws an IllegalBlockingStateException), but it cannot be read synchronously in this non-blocking mode.
    Is there any way I can connect a BufferedReader to a non-blocking SocketChannel somehow?
    There would be an alternative approach, where the listeing thread reads the data from the SocketChannel into a ByteBuffer, then stuffs those bytes into a PipedOutputStream, and build a reader over a PipedInputStream.
    The problem is that in this case, we need, again, one thread per client to read the data froml the reader...
    There's a third approach, where we would use the "attachment" feature of SocketChannel.register() and SelectedKey; in this approach, the attachment could be a stringBuffer; each time the Selector warns us that data is readable, the data would be read from the SocketChannel into a ByteBuffer. then added to the StringBuffer. We would have to analyze the StringBuffer's content to find out whether it contains a whole line, and only then extract this line as the "PDU".
    Is this a recommended approach?
    Thanks in advance, and regards,
    J.
    Message was edited by: jduprez (some code markers had been swallowed)
    Message was edited by:
    jduprez

    OK, thanks.
    I implemented this third approach, and it works under moderate load. The difficulty though, is that what I can read from the channel is a chunk of binary data, possibly incomplete, and that possibly doesn't even translate to valid chars (for example, a 16-bits char may be cut in-between and I get only the first byte).
    That orients me to a binary protocol (at least, to a protocol where I can identify "end of message " markers at the binary level).
    Alternately, if I can ensure all my messages fit a UDP packet, I'd better stuff the String in a UDP packet on the client end, and decode a String from the UDP received (atomically) on the server end.
    I'd lose TCP's relative reliability, but simplify the programming model for the protocol handling...
    I'm still free to choose the transport at this step of the project...
    Any recommendation?

  • QOS problem (multicast) with 3750

    Hi,
    I need help to solve following problem.
    I have setup qos in our 3750, see below.
    Unicast traffic is handle correct, However with multicast streams the router set the dscp to 0
    Has somebody any idea what is missing?
    Too old sw?   Cisco IOS Software, C3750 Software (C3750-ADVIPSERVICESK9-M), Version 12.2(35)SE,
    Regards Niklas
    ip multicast-routing distributed
    ip multicast multipath
    mls qos srr-queue input priority-queue 1 bandwidth 10
    mls qos srr-queue input dscp-map queue 1 threshold 1  46
    mls qos srr-queue input dscp-map queue 2 threshold 1  11 24 30 48
    mls qos srr-queue output dscp-map queue 1 threshold 1  48
    mls qos srr-queue output dscp-map queue 2 threshold 1  46
    mls qos srr-queue output dscp-map queue 3 threshold 1  40
    mls qos srr-queue output dscp-map queue 4 threshold 1  11 24 30
    mls qos
    interface GigabitEthernet1/0/22
    switchport access vlan 41
    switchport mode access
    load-interval 30
    srr-queue bandwidth share 25 25 25 20
    priority-queue out
    mls qos trust dscp
    interface GigabitEthernet1/0/23
    switchport trunk encapsulation dot1q
    switchport trunk allowed vlan 40
    switchport mode trunk
    load-interval 30
    srr-queue bandwidth share 25 25 25 20
    priority-queue out
    mls qos trust dscp

    Hi,
    Here comes the printouts:
    with mls qos enabled:
    cisco-Mcast#sh mls qos interface gigabitEthernet 1/0/22 statistics
    GigabitEthernet1/0/22
      dscp: incoming 
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0            0            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      dscp: outgoing
      0 -  4 :     8881981            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0          307            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      cos: incoming 
      0 -  4 :           0            0            0            0            0 
      5 -  7 :           0            0            0 
      cos: outgoing
      0 -  4 :     8881981            0            0            0            0 
      5 -  7 :           0          307            0 
    Policer: Inprofile:            0 OutofProfile:            0
    cisco-Mcast#sh mls qos interface gigabitEthernet 1/0/23 statistics
    GigabitEthernet1/0/23
      dscp: incoming 
      0 -  4 :     8931330            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0          202            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      dscp: outgoing
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0         1206            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      cos: incoming 
      0 -  4 :    11357772            0            0            0            0 
      5 -  7 :           0            2            0 
      cos: outgoing
      0 -  4 :           0            0            0            0            0 
      5 -  7 :           0         1206            2 
    Policer: Inprofile:            0 OutofProfile:            0
    cisco-Mcast#
    mls qos disabled:
    cisco-Mcast#sh mls qos interface gigabitEthernet 1/0/22 statistics
    GigabitEthernet1/0/22
      dscp: incoming 
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0            0            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      dscp: outgoing
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0         7371            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0            0            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      cos: incoming 
      0 -  4 :           0            0            0            0            0 
      5 -  7 :           0            0            0 
      cos: outgoing
      0 -  4 :        7371            0            0            0            0 
      5 -  7 :           0            0            0 
    Policer: Inprofile:            0 OutofProfile:            0
    cisco-Mcast#sh mls qos interface gigabitEthernet 1/0/23 statistics
    GigabitEthernet1/0/23
      dscp: incoming 
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0        23281            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0            0            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      dscp: outgoing
      0 -  4 :           0            0            0            0            0 
      5 -  9 :           0            0            0            0            0 
    10 - 14 :           0            0            0            0            0 
    15 - 19 :           0            0            0            0            0 
    20 - 24 :           0            0            0            0            0 
    25 - 29 :           0            0            0            0            0 
    30 - 34 :           0            0            0            0            0 
    35 - 39 :           0            0            0            0            0 
    40 - 44 :           0            0            0            0            0 
    45 - 49 :           0            0            0            2            0 
    50 - 54 :           0            0            0            0            0 
    55 - 59 :           0            0            0            0            0 
    60 - 64 :           0            0            0            0 
      cos: incoming 
      0 -  4 :       29272            0            0            0            0 
      5 -  7 :           0            0            0 
      cos: outgoing
      0 -  4 :           0            0            0            0            0 
      5 -  7 :           0            2            0 
    Policer: Inprofile:            0 OutofProfile:            0
    cisco-Mcast#
    BR Niklas

  • Multicasting with a guest anchor configuration.

    Hi All
    First time posting. :-)
    I have a guest anchor controller in our DMZ servicing Apple devices. We are looking at options for using Apple TV to display/stream presentations from executive iPads and such. Since it uses bonjour (multicast) would I be able to utilize the new features available in 7.0.116.0 to implement this solution? I have 4 WiSM 1s servicing the headquarters building and one 4402 guest anchor. I believe this is possible based on the note in the document: VLAN Select and Multicast Optimization Features Deployment Guide; specifically the section:
    Note: In a Guest Tunneling scenario, roaming between export foreign and export foreign is supported. However, roaming between export foreign and export anchor is not supported with VLAN Select.
    In case of Auto Anchor:
    Clients joining a foreign WLC, which is exported to an anchor WLC and mapped to a interface group, will receive an IP address in round robin method inside the interface group.
    Clients joining a foreign WLC, which is exported to an anchor WLC and mapped to a interface only, will receive an IP address from that interface only.
    Clients roaming between two or more foreign controllers mapped to a single anchor WLC with an interface group configured will be able to maintain its IP address.
    Since I only have one guest anchor, I would assume based on this that I would fall under the export foreign - export foreign option and implementing this would be possible.
    Could someone advise?
    Thank you in advance!!

    Thank you for information, I have the same problem. So I made a search on EoIP tunnel and Multicast.
    http://www.cisco.com/en/US/products/ps6366/products_qanda_item09186a00808b4c61.shtml
    Q I have a guest tunneling, Ethernet over IP (EoIP) tunnel, configured between my 4400 Wireless LAN Controller (WLC), which acts as the anchor WLC, and several remote WLCs. Can this anchor WLC forward subnet broadcasts through the EoIP tunnel from the wired network to wireless clients associated with the remote controllers?
    A. No, the WLC 4400 does not forward IP subnet broadcasts from the wired side to the wireless clients across the EoIP tunnel. This is not a supported feature. Cisco does not support tunneling of subnet broadcast or multicast in guest access topology. Since the guest WLAN forces the client point of presence to a very specific location in the network, mostly outside the firewall, tunneling of subnet broadcast can be a security problem.
    unofortunately it seems that multicast over EoIP does not work.

  • Read file with nio and flush with servlet

    Can I read file, by using java.nio (for example by FileInputStream.getChannel()) and then flush the file content thru the servlet?
    I kwow about reading without java.nio, get a byte array and then flush it by httpservletresponse writer or outputstream, but I wish to know if it is possibile with java.nio reading.
    thanks

    I'm doing it only for file reading..
    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();    
            FileInputStream fis = null;                               
            try
                String path = "/var/hello.txt";
                fis = new FileInputStream(path);       
                FileChannel channel =  fis.getChannel();
                ByteBuffer bb = ByteBuffer.allocate((int) channel.size());
                channel.read(bb);
                byte[] data2 = bb.array();
                channel.close();
                out.write(new String(data2));
            } catch (FileNotFoundException ex)
                ex.printStackTrace();
            } finally
                try
                    fis.close();
                } catch (IOException ex)
    ex.printStackTrace();
                out.close();
        }

  • Working with NIO and non-NIO sockets

    Hello,
    Trying to write a network manager kind of program where the client initiates a number of connections to different servers. Need to manage these connections through the life time of the session ( time the client is connected to the server). The client connections originate from a single machine, the servers are geographically distributed and about 1 to 5 connections between each client and server.
    I have tried and example NIO client/server application and it works fine. I have tried the KnockKnock client/server example it works. But when I try to use the NIO client with the multithreaded knockknock server, the socket connection goes through okay. However the data written to socket channel on the client(NIO) side doesn't seem to reach the server(non-NIO). I can't change the servers since they already exist in the field. I am just trying to write the manager application to manage them.
    Basically I am trying to avoid writing a multithreaded socket connection management program.
    Thanks for any input.

    Not the greatest NIO code. The author seems unaware that closing a channel also cancels all its selection keys so he laboriously programs both operations every time he needs to close the channel. His discussion of OP_CONNECT makes little sense: the important point is that OP_CONNECT is only used in the connection phase and OP_WRITE is only used in the connected phase.
    His code registers the channel for OP_WRITE as soon as the connection completes, when there is no pending data to write. This will just cause the selector to spin uselessly doing nothing. The channel should be registered with zero interest-ops and OP_WRITE should be registered when there is something to write, i.e. during the send() operation; and it should be deregistered when the write has completed successfully and there is no more data to write.

Maybe you are looking for