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.

Similar Messages

  • Why is it that when I am trying to install an adobe product, I get 33% of the way through and then it gives me an error "unable to load metafile"??  It happened with Reader and now with Flashplayer.  With the Reader, I was able to find a different install

    Why is it that when I am trying to install an adobe product, I get 33% of the way through and then it gives me an error "unable to load metafile"??  It happened with Reader and now with Flash player.  With the Reader, I was able to find a different installation link using the troubleshooting guide.  I cannot find the same with flash player.  Please tell me how to install Flash player because there is a website that I cannot even view without it.  BTW That is annoying that I cannot even see the website without flash player
    my system is XP

    Use these installers:
    Flash Player for ActiveX (Internet Explorer)
    Flash Player Plug-in (All other browsers)
    Flash Player for Mac OS X
    For Adobe Reader go to http://get.adobe.com/reader/enterprise/

  • Read and write with usb printer

    hello friends
                            i m new in labview . can any body advised me how to read and write with printer that have USB interface . because latest printer connection are usb based not parallel port based.
    any example or material.
    i shall be very grateful to u
    thanks

    Hi,
    It depends on what type of driver you are using, and how that driver communicates with you printer. 
    There are lost of different ways LabVIEW can interface with external hardware, either using all libary function node, ActiveX, .NET, etc.  It all depends on what type of driver you are using.
    Regards
    Seamus

  • Issues reading and burning with superdrive (mac pro 1.1)

    I am starting to experience a very annoying issue: the superdrive in my mac pro started to get bonk; not reading dvd that i burned some time ago with nero on pc; then it started to cause issues while burning with any software (finder, disk utility, toast on mac, and also nero and clonecd using parallels and bootcamp.
    The drive in my machine is a IDE Optiarc AD-7170A (that should be either a NEC or a Sony; but either firmware is not recognized by the drive)
    The media that i am using are MEmorex -R and DL +R; both of them were working just fine earlier ( i do not burn anything since 6-7 months ago).
    Now this is what happens: I get errors while burning, but not while doing the simulation; the error appear at any speed (tried 2X and up); and i tried with ISO images, DMG, just dragging stuff from my desktop and the result is the same: no writing and error message right after the lead-in (i assume; since it stays on lead-in on toaster).
    Using bootcamp and vista, with Nero; I get a calibration error; and if i use the built in feature to burn data in vista, i get an error too.
    Now; I would give a shot to another brand of media (verbatim? TDK?); but the fact that i cannot burn anything in any OS with any software would be a clear sign that something is wrong either on the drive or on the firmware; hence my request of help to anyone that experienced this issue
    - i cannot update the firmware (that i see as 1.N8); tried to go on the sony and nec sites and download their windows utility but no luck....the drive is not recognized; so i wonder if Apple has no way to let us update a firmware, what is the point of buying a superdrive instead of a normal dvd burner?
    - if my drive is broken....can i buy any dvd-rw drive and stick it in my mac pro?
    thanks for the help!

    Thanks for the suggestion; I've installed a new dvd drive and now seems that everything is working fine!
    I've also cleaned the old drive, taking it apart, and now at least i can use it as spare to read and burn in case that the new one would not work.

  • How well does mac read and write with FAT32

    Hi there,
    I have heard that an external hard drive formatted in FAT32 from a windows machine will work with a mac. Is it a seemless read and write while using an application. i have both a pc and a mac and want both to use the same harddrive.
    Thanks,
    WayneAdams

    Hi,
    as brianking said, you won't be able to boot from it, but for an external drive fat32 works like a charm. I share three 250 GB external drives with my colleagues at work and we only once had a problem of destroyed FAT which might have been caused by the Mac, but was never examined since it did not happen again.
    volker

  • When using the Database Connectivity Toolset, reads and writes with long binary fields are incompatible.

    I am trying to write LabVIEW Variants to long binary fields in a .mdb file using the Database Connectivity Toolset. I get errors when trying to convert the field back to a variant after reading it back from the database.
    I next tried flattening the variant before writing it and ultimately wound up doing the following experiments:
    1) If I use DB Tools Insert Data to write an ordinary string and read it back using a DB Tools Select Data, the string is converted from ASCII to Unicode.
    2) If I use DB Tools Create Parameterized Query to do an INSERT INTO or an UPDATE operation, specifying that the data is BINARY, then read it back using a DB Tools Select Data,
    the length of the string is prepended to the string itself as a big-endian four-byte integer.
    I can't think of any way to do a parameterized read, although the mechanism exists to return data via parameters.
    Presuming that this same problem affects Variants when they are written to the database and read back, I could see why I get an error. At least with flattened strings I have the option of discarding the length bytes from the beginning of the string.
    Am I missing something here?

    David,
    You've missed the point. When a data item is flattened to a string, the first four bytes of the string are expected to be the total length of the string in big-endian binary format. What is happening here is that preceding this four-byte length code is another copy of the same four bytes. If an ordinary string, "abcdefg" is used in place of the flattened data item, it will come back as <00><00><00><07>abcdefg. Here I've used to represent a byte in hexadecimal notation. This problem has nothing to do with flattening and unflattening data items. It has only to do with the data channel consisting of writing to and reading from the database.
    I am attaching three files that you can use to demonstrate the problem. The VI file c
    ontains an explanation of the problem and instructions for installing and operating the demonstration.
    Ron Martin
    Attachments:
    TestLongBinaryFields.vi ‏132 KB
    Sample.UDL ‏1 KB
    Sample.mdb ‏120 KB

  • How To Read and Write with Listbox

    Looking for a simple example on how to write data into a Listbox via my Block Diagram.
    That indicates to me that my Listbox needs to be an Indicator (so I can write to it).
    But, if my operator selects one of the items from the Listbox, I want to be able to read what they selected - so it also needs to be a Control.
    Is there an example on how to do something basic like this?
    Thanks.
    Angus Cattle from Pool Ranch and Steel Repairs via Joe's Welding.

    I'm having a horrible time getting this to work.
    Attached is my attempt, but it certainly is not doing what I want.
    Once this VI works, I will start trying to pull values from the database.
    Any good suggestions on how to fix it?
    Angus Cattle from Pool Ranch and Steel Repairs via Joe's Welding.
    Attachments:
    Calibration.vi ‏26 KB

  • Reading and Wrting CSV format data

    I am trying to read in a file in CSV form and to store the data separately in a set of arrays, and by using the ordinary System.out output, print out to screen a summary report of the form. Can anybody please assist me in this please...any help would be very much appreciated.

    don't understand your question.
    Just read the file, using StringTokenizer to create tokens, .... print out what you want

  • Readding and writing with currect enties of xml into config file?

    Hey dear Developers,
    i ask about xml file for config.xml.
    If you change line of config.xml than application air will to read sometimes xml structures...
    Example:
    <config>
    <app>
      <lang>langde</lang>
      <style>default</style>
    </app>
    </config>
    If i change to this:
    <config>
    <app>
      <lang>langen</lang>
      <style>default</style>
    </app>
    </config>
    Than Application Air will to load currect ..
    If you change with failure or problem...
    <config>
    <app>
      <lang>langen
      <style>default</style>
    </app>
    </config>
    What does it happen while you changed this failured enties of config.xml. When Application Air will to load error message or create again new xml file?
    I have been tried i have problem of my writeconfig():void ...
    Thanks can you help me ?

    Its likely that there is an ADF deployment listener that is adding the skeleton faces-config.xml to the web application because it did not find one in the project in the standard location. OJDeploy simply invokes the JDeveloper deployment in headless mode to an archive that is the same as what you would see when deploying to an archive from within the IDE. You can verify this by deploying the same module from within the JDEV IDE.
    You can either move your validator to the JDev standard location WEB-INF/faces-config.xml or use Ant to do your build entirely. (if you don't need JDev specific deployment behavior). If this does not work for you, you could open a bug to see if it is possible to stop JDev from generating the skeleton file.

  • Would Lightroom 6 be able to read and work with photos in a Lightroom CC catalog should I decide someday to cancel my subscription at some time in the future?

    I will download and use Lightroom CC but want to know what my options will be should I someday cancel the CC subscription.
    I know that simply cancelling the subscription would mean that one no longer has access to the Develop module. Could a person cancel the subscription, purchase the stand-alone program and continue  to have full access to the photos in the catalog including edits?

    Depends what you mean by "in"!! I know the photos are in the folders that I have created.
    Thanks for the fast answer.

  • Read and Write with OPC through NI Vision

    Hi
       How can I Write and read directly from NI Vision to Plc?
    in other words, how can connect to another device through OPC by NI Vision?
    Many thanks for your reply.
    Best Wishes,

    We have several application notes that explain how to do that:
    Using Vision Builder AI as an OPC Server: http://www.ni.com/white-paper/13574/en
    https://decibel.ni.com/content/docs/DOC-18647
    For implementation in LabVIEW, just search for OPC on ni.com. There are a lot of documents explaining how to implement this communication protocol.
    If you give us more details (who you want to be the server or client), we can provide better guidance.
    Hope this helps.
    Christophe

  • How can I read and work with the e-mail on one IMAC (running 10.7.3) from my MacPro Power PC5 (running 10.5.8)

    I would like to be able to work the e-mails on my IMAC (Lion 10.7.3) from my Mac Pro Power PC5 (running Leopard 10.5.8).  I want to be able to see all the folders and have actions show up on the other computer.  In other words, if I delete the e-mail I want it to disappear in real time from the other computer.  The same would be for moving messages in and out of different folders.  Can this be done without setting a server?  If not, then what server version could I install on the MacPro that would let me do this?

    That is the way IMAP should work.
    Like gMail or iCloud, both of which can be setup on both Macs...
    Do not delete the old account yet. sign up for an iCloud account if you haven't.
    I understand .mac mail will still come through. Do not delete the old account yet.
    You cannot use .mac or MobileMe as type of Account, you have to choose IMAP when setting up, otherwise Mail is hard coded to change imap.mail.me.com to mail.me.com & smtp.mail.me.com to smtp.me.com, no matter what you try to enter.
    iCloud Mail setup, do not choose .mac or MobileMe as type, but choose IMAP...
    On second step where it asks "Description", it has to be a unique name, but you can still use your email address.
    IMAP (Incoming Mail Server) information:
    • Server name: imap.mail.me.com
    • SSL Required: Yes
    • Port: 993
    • Username: [email protected] (use your @me.com address from your iCloud account)
    • Password: Your iCloud password
    SMTP (outgoing mail server) information:
    • Server name: smtp.mail.me.com
    • SSL Required: Yes
    • Port: 587
    • SMTP Authentication Required: Yes
    • Username: [email protected] (use your @me.com address from your iCloud account)
    • Password: Your iCloud password

  • Switcher - Reading and Writing External IEEE HDD's

    Greetings,
    i'm trying to read and write with my external ieee drive on windows and the mac pro. it's format is ntfs, and is read only on the mac pro.
    i am admin and can't seem to change the permissions to read / write.
    the over all idea is i need to go back and forth between operating systems reading and writing from both sides of the house.
    here's a snapshot.
    http://briankross.com/images/500GBIEEEHDD.jpg
    Mac Pro   Mac OS X (10.4.8)  

    Unfortunately, no. In order to convert the drive to FAT32 it must be re-partitioned which is a destructive process.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • Problems with Adobe Reader and Flash Player

    I had an Adobe update last Monday and, ever since then, I can't view documents (eg credit card statements) on screen and sites that I previously visited regularly without problem suddenly say that I need to have Adobe Flash Player installed. I've downloaded Adobe Flash Player and it says it's installed correctly but when I return to the site, it still says I need Adobe Flash Player. I've also tried doing an uninstall first and then an instal but the same thing happens. I've run disk first aid and it found a problem with the Head which it fixed but I still can't open documents using Adobe in Safari. Adobe Plug ins tells me that the Internet Access plug in is not loaded but when I ran 'repair Adobe Reader installation", it said there were no missing components detected and repair was not needed. I don't know if it's relevant but I've been having problems with Safari for several weeks, quitting 3 or 4 times a day, mainly when I'm switching from Safari to another programme such as Entourage or Excel.
    Message was edited by: Aileen2

    Hi Carolyn
    I don't think I made it clear on the original post that I'm having problems with both Adobe Reader AND Adobe Flash Player. Unfortunately, all the Adobe Reader sites are confidential so I can't give you an illustration on that but for the Adobe Flash Player, try www.jacquielawson.com/ - you can preview cards without being signed in. With the Adobe Reader problems, I get a picture of a blank 'piece of paper' with a small blue square in the top right hand corner that has a white question mark inside it. The first time this happened to me, I was on the UK Inland Revenue site trying to print out some end of year forms. I phoned the Revenue's helpline and they said to try doing a 'save as' to my desktop. It seemed bizarre - saving a blank piece of paper - but lo and behold, when I opened it on my desktop, the forms appeared exactly as normal. However, I've since tried this 'save as' technique with my credit card statement and I still get a blank piece of paper with a blue square and white question mark when I open the desktop copy.
    Thanks for your help and patience. I really appreciate it.
    Aileen

  • Help with opening Adobe Reader and downloading updates

    I can not open Adobe .pdf files any longer (this started yesterday, prior to that I could open adobe files).
    When I double click a .pdf file I get this notice on my screen: Windows cannot access the specified device path or file. You may not have the appropriate permission to access file.
    So I went to the Adobe download site to download a new copy of Adobe.  When I start the download I get this on the screen:  The instruction at "0x0e3a0068" referenced memory at "0x0e3a0068."  The memory could not be written.  Then two options are listed: click OK to terminate or cancel to debug.  So I click on cancel and I get this on my screen: Internet Explorer has closed this webpage to help protect your computer.   A malfunctioning or malicious addon has caused I.E. to close this webpage.
    I don't have AVG running, I do have avast but I've disabled it.  I ran Registry Mechanic and an I.E. erasure program but nothing helps.
    I have gone into I.E. and reduced the security level to its lowest state but no joy.
    So, any ideas or suggestions on what's the problem and how to overcome it would be appreciated.  Thanks, in advance, for your reply.  Jim R.

    Hi Mike..tried that as well but no joy.  A friend of mine was looking at it all and noticed that it was an I.E. thing as far as not letting me redownload the reader so I went to Mozilla Firefox and I could download a new version but....whenever I attempt to open a .pdf file I get that message, "Windows can not open the specified device, path or file. You man not have the appropriate permissions to access the item." 
    Damn...this is irritating as I need to get to some of thos files as I need them for a Journal I'm working on as editor-in-chief. 
    It all worked just fine last Saturday but starting Monday when I was on my flight out to D.C.  no joy. 
    Sigh...Jim R.
    Jim R.
    Date: Tue, 1 Dec 2009 14:50:27 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help with opening Adobe Reader and downloading updates
    Under the help menu, there is an option to repair the installation of reader. Did you try that?
    >

Maybe you are looking for

  • Cisco VPN no longer working after firmware update

    I have been using the Cisco VPN network connection to access work; after the recent update, both my Macs stopped working -- no changes have been made. Is this a known bug? I looked at the settings, verified everything with no luck. Thanks.

  • B2b unable to pick the file from xml gateway

    Hi All, I am taking a scenario where B2B picks the files from xml gateway and drop the files in FTP folder. I modified the XML gateway inbound and outbound, i has given my user credentials(unmae, host ,pwd ,sid, port). In agreement in the place of in

  • Direct procurement & plan driven procurement

    Hello experts, i have the following basic questions - 1- is the local PO in extended classic scenario contain Purchase org info? how the Purchase Org is determined ? 2- is Direct material procuremnt  can only be used in case of Extended classic scena

  • The viewer is missing.

    When I go up to window, it shows that it is active, but when I click on a clip to show up in the viewer, it still is gone.  How can I get it back?

  • Trouble with variables

    Hi everyone. So, here we go, im about to pull what little hair Ive got left. I figured out how to accomplish the script, Im just screwing up somewhere in the execution. Basically, I'm trying to load a variable. The challenge is that this variable has