Nio udp with selectors

Hello,
Ive been looking for implementation of nio udp sockets with selectors all over the internet but i didnt get much. Does anyone here know of any websites with simple examples on nio udp sockets with selectors? (server + client),
thanks.
Paul

JGroups supports UDP but only old IO.
However Grizzly Messaging uses NIO UDP. [https://grizzly.dev.java.net/nonav/xref/index.html] e.g. [https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/UDPConnectorHandler.html]
I would be interested if you get UDP working over the internet. I would have thought the packet loss rate would be too high and too unpredictable to make it worth using (compared with TCP). So if you can prove me wrong please let me know!

Similar Messages

  • [svn:fx-trunk] 8303: This change tries to support legacy usages of StyleManager. setStyleDeclaration() while keeping the new "subject based" internal index of style declarations in sync with selectors.

    Revision: 8303
    Author:   [email protected]
    Date:     2009-06-26 07:50:46 -0700 (Fri, 26 Jun 2009)
    Log Message:
    This change tries to support legacy usages of StyleManager.setStyleDeclaration() while keeping the new "subject based" internal index of style declarations in sync with selectors. We no longer support the invalid usage of constructing a CSSStyleDeclaration with one selector but re-registering it with StyleManager.setStyleDeclaration with another selector.
    QE: Yes, look out for test cases that incorrectly create a CSSStyleDeclaration with a selector AND also use StyleManager.setStyleDeclaration(). I saw one invalid usage in the mustella test file: tests/Managers/StyleManager/AdvancedCSS/mixedSelectors/AdvancedCSS_MixedSelectors, specifically the "CSSStyleDeclaration_CSSSelectorKind_Type_method" test case.
    Doc: Yes, please remove any examples that showed a CSSStyleDeclaration being constructed with a "name" as that is incorrect. You only construct these instances with a selector, or nothing.
    Reviewer: Glenn
    Checkintests: Pass
    Bugs:
    SDK-21714 - Dynamically created styles are ignored by spark components
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21714
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleManagerImpl.as

    Hi,
    Found a note explaining the significance of these errors.
    It says:
    "NZE-28862: SSL connection failed
    Cause: This error occurred because the peer closed the connection.
    Action: Enable Oracle Net tracing on both sides and examine the trace output. Contact Oracle Customer support with the trace output."
    For further details you may refer the Note: 244527.1 - Explanation of "SSL call to NZ function nzos_Handshake failed" error codes
    Thanks & Regards,
    Sindhiya V.

  • Problem while SocketChannel registers with selector

    Hi ,
    I am coming across problem when i tries to register channel (SocketChannel) with Selector.
    Following is the scenario:
    1) I create selector in main program
    2) I spawns thread and calls (selector.select()) in that thread using created selector in main program
    3) Now I have to do toggle of this created SocketChannel (close() the channel and open() again in main program)
    4) I close the channel in main program ( i have synchronized channel during close operation)
    5) When I try to register again after opening socket my main program hangs forever...Actually
    I am seeing random behavior at this point. Some time it works and registers channel with selector
    and some time it hangs...Socket connection established correctly..just channel for that socket connection
    can not able to register with selector that is currently doing select in another thread...
    Please let me know if anybody come across this kind of problem.
    Thanks a lot,
    Priyank

    Thanks a bunch for the above messages, it actually solved one of my problems, which was,
    I was,
    1. Making serverSocketChannel and registering it with the selector.
    2. Starting selector thread.
    3. Making ClientSocketChannels and registering these with the selector.
    As the selector was started at Step 2, Step 3 was getting blocked, because of selector thread making selector busy, so i read the above messages, and inferred that
    1. Make SerSocketChannels
    2. Make ClientSocketChannels
    3. Start Selector
    and it solved my problem of my program getting blocked at step 3 in the first arrangement. So once again thanks alot to the guys here for making a useful discussion and helping me
    --Aamir                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • NIO: issues with the IO part

    I've been working on a multi client/ server system, and I had success with traditional networking using Sockets, streams and Threads to handle each connection. In an attemp to make my srver more efficient using asynchronous communication (which I am forever regretful for) I have completely destroyed all funtionality of the program. My server is now successfully asynchronous, but it does not communicate.
    I have tried an and all variations of sockets, streams, socketChannels, Readable/Writeable ByteChannels, ObjectInput/OutputsStreams, and nothing is working. It comes to the same part each and every time and fails to continue. I'm trying to read in an array of characters from the SocketChannel, and parse them with basic ByteBuffer get commands. The Client seems to be writing the buffer which I know is properly filled with data, but the server side socket never recieves it, it just holds, or when I have it set to non blocking, returns null on the read() command.
    Heres some of the code for the server. If it looks familiar its because I got it from a tutorial off IBM after getting frustrated and deleting my original code.
    Selector selector = Selector.open();
    // Open a listener on each port, and register each one
    // with the selector
    ServerSocketChannel serverSocket = ServerSocketChannel.open();
    serverSocket.configureBlocking( false );
    ServerSocket ss = serverSocket.socket();
    InetSocketAddress address = new InetSocketAddress( port );
    ss.bind( address );
    SelectionKey Acceptkey = serverSocket.register( selector, SelectionKey.OP_ACCEPT );
    while (true) {
    int num = selector.select();
    Set selectedKeys = selector.selectedKeys();
    Iterator it = selectedKeys.iterator();
    while (it.hasNext()) {
    SelectionKey key = (SelectionKey)it.next();
    if ((key.readyOps() & SelectionKey.OP_ACCEPT)
    == SelectionKey.OP_ACCEPT) {
    // Accept the new connection
    ServerSocketChannel ssc = (ServerSocketChannel)key.channel();
    SocketChannel sc = ssc.accept();
    sc.finishConnect();
    sc.configureBlocking( false );
    // Add the new connection to the selector
    SelectionKey newKey = sc.register( selector, SelectionKey.OP_READ);
    it.remove();
    System.out.println( "Got connection from "+sc );
    } else if ((key.readyOps() & SelectionKey.OP_READ)
    == SelectionKey.OP_READ) {
    // Read the data
    SocketChannel sc = (SocketChannel)key.channel();
    // Echo data
    in.clear();
    sc.read( in ); // <--------------------- this is where it stops
    in.flip();
    char command = in.getChar();
    if (command == 'l')
    CharBuffer cb = in.asCharBuffer();
    String Username = getString(cb);
    String Password = getString(cb);
    System.out.println("Login Attempt: User: " + Username + " Pass: " + Password);
    it.remove();
    for the client side i have tried almost every thing. I had similar trouble when I used Streams originaly, but the problem was that I had forgotten to flush the stream. I have tried using streams to communicate with the channel, or even getting the socket from the client socketchannel and then fluching its outputstream. and neither worked, even though I saw this in a tutorial somewhere online.
    Alas, I am completely out of ideas and extremely frustrated at the days of time lost on this upgrade that would have made for better performance had it actually performed. I you can think of what kind of client side code woul dbe necessaryto make this work, please let me know. I have tried simply making a channel, connecting it, filling a buffer (which works), and doing clientChannel.write(buf). No, this odes not work. EVERY tutorial says this is how to do it, but I'm special some how.
    HELP ME!!!
    Jon

    Never release your socketChannel reference(s) unless it/they has/have been fully qualified
    by socketChannel.isRegistered();
    Otherwise you can wipe out your iterator by having the references garbage collected
    before they have actually been freed.
    In the event of an exception on the channel, before releasing the reference
    call socketChannel.isRegistered(). It may take some time to qualify and thus
    I make a list of channels that have had exceptions such as the user disconnecting
    and poll socketChannel.isRegistered() every so often untill it qualifies,
    Then and only then release the reference to the channel.
    I went even one further.. I interleave the OP_READ and OP_WRITES in different
    properly synchronized Threads, and never combine the options on the same Selector
    at the same time. Further always using a timeout on my selector ensures
    it won't race for(;;) and or get saturated.
    I ran my NIO server for 6+ months straight no problems and have tested it to 7200+ concurrent connections. Actually I am almost at the point where other people can use it via an easy interface.
    Hmm if I could just find time to finish between my job and woman :)
    I am going to work onit as much as I can this weekend and I am making it totally
    configurable and usable from an easy GUI.
    Anyway, check where you remove your channel references
    Hope this helps.
    (T)

  • Java NIO - UDP packets

    I'm curious as to the rationale behind having a DatagramPacket class and just using ByteBuffers for TCP connections. I can see the logic, but I'm trying to write a Java framework wrapping NIO with TCP and UDP connections. In my C++ version I have one packet class that I use for both types of connections. I'm stuck with what to implement for Java as I'm going to need two classes, NIO's DatagramPacket and a new TCPPacket. Ideally I would like both to implement an interface or derive from a parent class so I can pass them to all class methods that deal with packets, be they UDP or TCP based. But this won't work. I could wrap DatagramPacket into a new class, and have it and the TCPPacket class implement a Packet interface. But when I'm sending UDP packets I'll be creating two objects for the price of one.
    Any suggestions?
    Thanks

    Remember that in UDP case you can easily lose packets and never know. In TCP you would receive an exception, but UDP can silently discard your packages while in transit.
    My point is, you probably should use a different package class for UDP anyway, maybe adding some stuff like a package ID that would enable re-sending and additional processing in order to ensure a successful communication.
    If you already have this information and some procedures for retrying in your package, then I agree with the previous poster in that you can use bytebuffer for both.

  • NIO bug? selector doesn't return

    Hello,
    I have a strange problem with my server. When a number of concurrent connections became more than 1000 the server hangs up.
    I use NIO API to manage connections. The server logic is IRC-style, it broadcasts a large number of small messages. In one moment it may disconnect all the users and doesn't accept anymore incoming connections in spite of the java runtime continue working. I wrote a daemon that periodically makes thread dump to log file. When the server works normally the selector thread looks like this:
    IOManager:
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
        sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
        sun.nio.ch.SelectorImpl.select(Unknown Source)
        ioserver.IOManager.run(IOManager.java:143)But when it doesn't respond appear two new "hepler" threads and the dump looks like:
    IOManager:
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$FinishLock.waitForHelperThreads(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$FinishLock.access$600(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
        sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
        sun.nio.ch.SelectorImpl.select(Unknown Source)
        ioserver.IOManager.run(IOManager.java:143)
    Thread-600:
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$StartLock.waitForStart(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$StartLock.access$2400(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$SelectThread.run(Unknown Source)
    Thread-599:
        java.lang.Object.wait(Native Method)
        java.lang.Object.wait(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$StartLock.waitForStart(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$StartLock.access$2400(Unknown Source)
        sun.nio.ch.WindowsSelectorImpl$SelectThread.run(Unknown Source)The selector thread never returns from select operation. I don't know what is the cause of this behavior but I think that a problem is not in my java code. What can I do to solve the problem?
    P.S.
    The hardware isn't so powerful (2 CPUs Pentium III 500) thus it always has 50%-80% of load. Operating system is Windows 2003 Server for Small Business Server (without SPs). JRE: 1.5.0_09 Server VM. Socket receive buffer size: 1024, send buffer size: 4096.
    Ant�n

    Now having looked at the code and where the helper threads are and the main selector thread it seems that they are in a deadlock. From the code it seems very unlikely, since the timing has to be just right.
    As an example,
    Assumptions:
    1) we do a select and because of the number of keys we select on, we need to create 3 helper threads. (so we have the main thread and 3 helpers = 4 total)
    2) The system is quite busy and we are doing 100's of selects / minute and we also wakup the selector for adding and removing keys (cancelling keys etc.)
    Event sequence:
    1) We call select which calls the WindowsSelectorImpl
    2) It creates 3 helper thread (also sets threadsToFinish = 3)
    3) First thread gets created and waits on startLock
    4) Other 2 helper threads get pre-empted out before they can wait on startLock
    5) main thread wakes up everyone waiting on startLock (so one gets started, the other 2 don't)
    6) Main thread enters poll and exits pol
    7) 1st helperThread that was started goes into poll and finishes, calls wakeup on other threads (but they are not waiting yet)
    8) 2 remaining helper threads now get to wait on startLock (not sure if this part can take that long)
    9) main thread now checks threadsToFinish and sees 1 thread is finished and doesn't call wakeup, goes to code where it waits for the helper threads, but they are waiting and missed all the wakeup calls because they took "long" to start.
    So there is a couple of things that need to fall in place for this to happen:
    1) lots of calls into doSelect
    2) relatively busy system (so some of the helpers take long to start)
    3) a key in the main thread and a key in the 1st started helper triggers almost immediately
    Seems that there is a need in the main thread to check if there are any helpers that might have missed the notification to start on startLock, if so, it might need to call it again ??
    Reinier
    PS: The funny thing though is that at the time I only had 1023 keys in the selector, yet there are 2 helper threads that suggest 1024 (main) + 1024 (helper 1) + 1024 (helper 2) = 3072 channels / keys ?
    Edited by: rbezuide on Apr 2, 2008 11:09 AM

  • UDP with cRIO and error 113

    Hi all,
    i'm using the UDP protocol to exchange information between a PC and a cRIO; the first is the master, the second is the slave.
    In the cRIO i developed a piece of code in order to realize a loopback, so that the message sent from the PC is sent back to the PC itself as it has been received, without any modification.
    First, i tried sending a short message (100 B) from the PC to the cRIO; in this case, no problem at all
    Then, i tried sending a long message (20 kB) from the PC to the cRIO; in the cRIO code, the error number 113 was raised when trying to send back the message to the PC (calling the UDP write function)
    What can be the origin of the different behaviour between the PC and the cRIO? Seems to be a question of buffer size... Can it be dependent of the OS? How can i increase it in the cRIO?
    Thanks!
    aRCo

    Hi aRCo,
    According to Wikipedia (https://en.wikipedia.org/wiki/User_Datagram_Protoc​ol), the max. theoretical limit for a UDP datagram is 8 bytes for header + 65,527 bytes of data (65,535 bytes in total). However, "the practical limit for the data length which is imposed by the underlying IPv4 protocol is 65,507 bytes (65,535 − 8 byte UDP header − 20 byte IP header)". The wiki article goes on to say that larger packets are possible with Jumbograms.
    As for the NI documented limits of 8K, this would appear to be a LabVIEW-imposed limitation. (Perhaps this was related to an earlier limitation of the UDP protocol that has since been upgraded. If I recall correctly, the Windows version of LabVIEW also had this 8K limitation in the past.)
    Perhaps NI relaxed this limit, or maybe you have jumbo packets enabled on youir PC, and this is allowing more throughput (-- of course both of these possibilities are only speculation on my part).
    In any event, if you limit the UDP packet size to the documented 8K limitation, your code should probably be fine across all LV platforms. (How's that for stating the obvious..?)
    Anyway, good luck with your application.
    -- Dave
    www.movimed.com - Custom Imaging Solutions

  • Connect a CMD600 charge amplifier in TCP/UDP with LV2009

    hi there,
    I 'm triing to connect an HMB CMD600 charge amplifier using LAN with TCP/UDP.
    Should i use, the standart Open/Read/Close TCP functions or UDP or something else?
    How can i know or set the IP or port to listen ?
    I 've got 2 amplifiers to connect simultenaously, is it possible ? with a switch or with 2 wires from 2 LAN ports ?
    And last one : What s the maximum frequency of aquisition ?
    Sadly, i dont have access to the amplifier to test anyting.
    Thanks a lot

    Hi David,
    I advise you to have a look at the following links, there are a lot of examples and tutorialon the ni.com website:
    TCP/UDP LabVIEW 2009 Help 
    TCP/UDP examples on ni.com
    TCP/UDP Tutorials on ni.com
    Kind regards,
    Olivier L. | Certified LabVIEW Developer

  • NIO + UDP + Empty Packet

    Hi,
    I'm in a case where I have to send an empty UDP packet.
    When i send datas i use: DatagramChannel.send(...)
    This method is supposed to return the number of bytes sent (0 or the size of the buffer).
    However when I'm sending an empty buffer, In case of both success or failure, the returned value is 0.
    I can capture my empty packet, no problem, but if my socket output buffer is full, how do I know if I sent my empty datagram package or not ?
    Thanks in advance.

    DrClap wrote:
    I don't see the problem. In one case the server received a packet, but there wasn't anything in it. In the other case the server didn't receive a packet. In both cases the server received nothing, so there is no difference between the two cases.I'm talking about UDP, not TCP, so at receiver side there is a difference between receiving an empty packet and receiving no packet at all. However, the receiver is able to receive an empty packet so there is no problem.
    ejp wrote:
    I can capture my empty packet, no problem, but if my socket output buffer is full, how do I know if I sent my empty datagram package or not ?You don't.The problem is in fact at the sender side. And that answer is what i was afraid of ;-)
    The probability of this happening is quite thin, however in any NIO Reactor you're supposed to handle the case where you could not send the datas and send them later again.
    I wonder if this problem could be considered as a lack/bug of the nio classes.

  • Reading and wrting with selectors

    Heres the code is used for Reading. The problem is that when the client send the server some bytes it goes into the loop and exits which is good however it does not delete the Selected Keys set from the selector. I thought that after ever slection process it deletes the set of selectedkeys however I cant seem to get that to work. =/ This is causing the server to keep going through the loop every time the method is invoked =/
         private void ReadMessages() throws IOException {
              int ReadyUsers = Select.selectNow();
              if (ReadyUsers <= 0) {
                   return;
              } else {
                   Set<SelectionKey> Keys = Select.selectedKeys();
                   Iterator<SelectionKey> i = Keys.iterator();
                   while (i.hasNext()) {
                        SelectionKey Temp = (SelectionKey) i.next();
                        i.remove();
                        SocketChannel SChan = (SocketChannel) Temp.channel();
                        System.out.println("Finished Reading and writing");
         }Edited by: NavjotMinhas on Sep 16, 2008 3:44 PM

    Heres the code is used for Reading.There is no code here that does a read.
    The problem is that when the client send the server some bytes it goes into the loop and exits which is good however it does not delete the Selected Keys set from the selector.Your it.remove() does that. The real trouble here is that you are never doing any reads, so the same keys are selected next time around, because they are still ready.
    System.out.println("Finished Reading and writing");This printout is lying to you! You haven't finished anything at this point.

  • Sending voice over UDP with JavaSound

    Hello,
    do anybody know how to send voice over UDP?. I have .wav files and I want to send them over UDP. If you have an example of this, send me it please. All the examples that I have seen only send one or to lines of text, but I need to know if I should convert the frames to bytes to be sent.
    Thank your help

    Hello,
    do anybody know how to send voice over UDP?. I have .wav files and I want to send them over UDP. If you have an example of this, send me it please. All the examples that I have seen only send one or to lines of text, but I need to know if I should convert the frames to bytes to be sent.
    Thank your help

  • 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.

  • Using nio And udp

    My first question is. If my server is using nio datagramchanels, my client must use it too?
    can i use traditional datagram socket for comunicate with a nio udp server?
    I have much information on nio and tcp with examples that work. but i can't find examples of communication between client and server using nio UDP. Some page of reference or tutorial?

    My first question is. If my server is using nio
    datagramchanels, my client must use it too?No.
    can i use traditional datagram socket for comunicate
    with a nio udp server?Yes.
    I have much information on nio and tcp with examples
    that work. but i can't find examples of
    communication between client and server using nio
    UDP. Some page of reference or tutorial?You haven't looked very hard. Try 'NIO UDP example' on google.

  • Troubles with timeout using java.nio.channels and non-blocking sockets

    Hello.
    I have a server application that employs java.nio.channels with non-blocking sockets.
    The server waits for connections. The client should connect and be first in sending data.
    Timeouts are significant! If client exceeds the allowed time to send data, the server should break the connection.
    The huge trouble I've discovered that I cannot control the timeout when client connects but remains silent.
    My code looks as follows:
    <pre>
    Selector oSel;
    SocketChannel oSockChan;
    Socket oSock;
    SelectionKey oSelKey;
    Iterator<SelectionKey> oItSelKeys;
    int iCurrState, iMask, iCount;
    iCurrState = INT_SERVER_WORKING;
    iMask = SelectionKey.OP_ACCEPT | SelectionKey.OP_CONNECT | SelectionKey.OP_READ | SelectionKey.OP_WRITE;
    while ( iCurrState == INT_SERVER_WORKING )
    try
    *// retrieving next action*
    iCount = oSel.select();
    if ( iCount > 0 )
    oItSelKeys = oSel.selectedKeys().iterator();
    while ( oItSelKeys.hasNext() )
    oSelKey = oItSelKeys.next();
    oItSelKeys.remove();
    if ( oSelKey.isValid() )
    switch ( oSelKey.readyOps() & iMask ) {
    case SelectionKey.OP_ACCEPT :
    oSockChan = oSSockChan.accept();
    oSockChan.configureBlocking(false);
    oSock = oSockChan.socket();
    oSock.setKeepAlive(true);
    oSockChan.register(oSel,SelectionKey.OP_READ,new MyPacket(oSock.getInetAddress(),oSock.getPort()));
    break;
    case SelectionKey.OP_READ :
    oSelKey.interestOps(0);
    ((MyPacket) oSelKey.attachment()).inRequest(); *// preparing request*
    this.getReader().add(oSelKey); *// sending key to reading thread*
    break;
    case SelectionKey.OP_WRITE :
    oSelKey.interestOps(0);
    ((MyRequest) oSelKey.attachment()).inResponse(); *// preparing response*
    this.getWriter().add(oSelKey); *// sending key to writing thread*
    break;
    case SelectionKey.OP_CONNECT :
    default :
    *// nothing to do*
    catch ( IOException oExcept )
    *// do some actions*
    </pre>
    Timeouts are easily controlled by reading and writing threads (see OP_READ and OP_WRITE ).
    But when a client just connects without consequent data send, the state of this connection remains as OP_ACCEPT. The connection remains open for arbitrarily large time and I cannot control it!
    Please help with idea how can I terminate such connections!

    How can I process the keys that weren't selected at the bottom of the loop? Should I use the method keys() ?Yes. Form a new set from keys() and removeAll(selectedKeys()). Do that before you process selectedKeys().
    And the second moment: as I understood a single key may contain several operations simultaneously? Thus I should use several if's (but not if/else 'cause it's the equivalent of switch ... case ).If there is anything unclear about 'your switch statement is invalid. You need an if/else chain' I fail to see what it is. Try reading it again. And if several ifs were really the equivalent of "switch ... case", there wouldn't be a problem in the first place. They're not, and there is.

  • NIO with SSLEngine API - Simple example required

    Hi
    I am trying to implement a NIO Server with SSL Engine based implementation. I went through the Https server given in the samples provided with jdk 5.0. But that is little bit more complicated (uses Handlers and other associated functionality). what I am looking for is a simple example program which can elucidate the SSL Engine API operations and the bare minium code to execute a simple Client Server communication through SSL Engine. I know it has a long learning curve, just thought if somebody has researched well and posted an article/tutorial in this regard, it would be really helpful for novice programmers like me. Please help with some sample programs..
    Thanks

    Unfortunately the bare minimum is extremely complicated. The JSSE samples contain some simplistic NIO code but it barely works, and doesn't cope with useClientMode=true at the server, or with re-handshakes.
    There is some PD code out there if you can find it, and also several discussions in the Secure Sockets forum.
    There is also an entire chapter on it in my book http://www.telekinesis.com.au/wipv3_6/FundamentalNetworkingInJava.A21.

Maybe you are looking for

  • ICal suggestion

    I would like to make a suggestion to iCal. in Month View of Calendar, there is no Weeks of the year. For example, November 17th~23rd is the 42nd week of the year. Can Apple add this info at the side of Calendar? Much obliged.

  • How to install Camera Raw 7.1?

    I have download Camtera Raw 7.1 for Sony Nex7 and Elements 10. I also download the Applicaion Manager. How to install the Camera Raw 7.1?

  • Problem with the audio editor window into logic pro X

    hello everybody, I have a problem with the audio editor window ! the "onglet" (sorry I don't know the word in english) "file and track" doesn't appear in the top of the audio editor window ! I can just make no destructive data, I have no access to No

  • Security Error

    The following code's HttpService request works when the swf is downloaded from the same server from where the request is made. But when I open a browser locally and open the swf without downloading or in a local Tomcat server, I get a security error.

  • Passing values to RFC/BAPI Table

    Hi, I am having a very strange problem. While passing the values to RFC/BAPI table using add method the values are not passed to backend SAP. Below is the code which I am using just to pass some data in RFC/BAPI table. The same code was working few d