SSE AppInputStream.avaible() returns 0 until first byte has been read

Hi!
I am new to JSSE and have tried to enable an existing application
for SSE connections.
In some sample applications everything worked fine, but in the
existing application nothing happened.
I found out that my existing application uses InputStream.available()
to check if the input stream has already some bytes available
and does nothing if there are not any bytes available.
The problem is that the com.sun.net.ssl.internal.ssl.AppInputStream
which is returned by SSLSocket.getInputStream() returns 0 if I call
available() until a first byte has been read. This behaviour
blocks my application because it does not start to read before
some bytes are available.
Is this a bug or desired behaviour?
If this is a bug, is there any workaround or fix for this?
I looked already for existing posts or bug fixes but I only
found a post containing the same problem without any answer.
Thanx in advance for your help!
Bye,
Michael.

My workaround is to wrap the inputstream by a BufferedStream. As only a real "read" can determine if there is any data exist, you must do so. However, you do not want the read to be blocking, so the only way is to perform a pseudo read, timeout the read asap and reset the stream for your original program.
Example code:
public int available() throws IOException {
int avail = 0;
int oneByte = -1;
int timeout = 0;
if (mSocket != null && mSocket instanceof SSLSocket) {
     try {
          timeout = mSocket.getSoTimeout();
          mSocket.setSoTimeout(2);
          in.mark(256);
          oneByte = in.read();
          in.reset();
          avail = in.available();
     } catch (SocketTimeoutException e) {
          avail = 0;
     } finally {
          mSocket.setSoTimeout(timeout);
} else {
     avail = in.available();

Similar Messages

  • Message reads Apple tv cannot sign in to Itunes until network time has been set; please try again later...help!

    in setting up new apple tv, message says "apple tv cannot sign in to Itunes until network time has been set - please try again later.........is this an easy fix?

    Welcome to the Apple Community.
    Assuming this is not the first time you have used your Apple TV
    You might try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Also try restarting the router.
    If the problem persists, try a restore, you may want to try the previous procedures several times before doing this.
    If restoring from the Apple TV doesn't help, try restoring from iTunes using a USB cable.
    If this is a new Apple TV, in addition to trying the above, it may also be that your network router is not allowing access to the timeserver, check that your router allows access over port 123.

  • How can I delay my MBP from hibernating until the lid has been closed for a set period of time?

    After extensive research, I have been unable to solve this problem and I'm hoping someone can explain this to me.   Everytime I close the lid on my 13-inch, Early 2011 Macbook Pro, it immediately starts to write to disk (solid light on the front) for several seconds until it finally goes into Hibernate mode (flashing light on the front).  The problem is, I frequently close the lid, then immediately reopen it within 15-30 seconds to resume typing or to add something I may have forgotten.   Each time I reopen the lid before the light has started flashing, the MBP wakes for a moment, and allows me to resume typing.  However, the Hibernation process has already begun and within 30 seconds, the screen goes blank.   I have to wake it AGAIN, which is very annoying.
    Based on my research, I could use pmset to change the hibernatemode to 0 (it is currently set at 3).   However, I dont wish to disable hibernate mode completely; I DO want it to save a hibernation image to disk if it happens to run out of battery, so that when I resume I havent lost anything.   
    I then researched using standby and standbydelay to attempt a delay of the write to disk when going into standby mode.   According to the pmset manual:
    standby causes kernel power management to automatically hibernate a machine after it has slept for a
         specified time period. This saves power while asleep
    standbydelay specifies the delay, in seconds, before writing the hibernation image to disk and powering
         off memory for Standby
    I then set these values as below, expecting the laptop to wait 4200 seconds (70 minutes) before trying to write to disk when I close the lid:
    standbydelay         4200
    standby              1
    Unfortunately, that did not work either.   If I close the lid, the light glows solid immediately (indicating it is writing to disk), and if I try to reopen the lid before it is done, it will wake and seem fine, then 30 seconds later it goes blank right in the middle of me typing something.   I usually have to click the mouse several times, or even the power button to re-wake it.  
    I do have InsomniaX installed, for when I want to close the lid and keep the machine awake permanently (while watching videos on airplay) and I have tried quitting that application to test this.  However, when I close/reopen the lid..the result is the same.   I cant keep InsomniaX enabled all the time, because it will never go to sleep when I truly want it to.   If I am not using InsomniaX, I just want to delay hibernation until he lid has been closed for a set period (say 15 minutes or more).  If I have not reopened the lid within that time, I want it to write to disk and go into hibernation mode.  And if the battery runs all the way out, I want it to go into hibernation mode before shutting down so I can recover.
    I would appreciate any help in solving this problem.  Also any insight as to why the standbydelay setting above did not work.   Thanks!

    Whats with the MBP lid? Dont close it ... if you're so concerned! Just go to System Preferences/Energy Saver and set it to how you like it.

  • "Please wait until your phone has been activated"

    I got a refurbished phone from Asurion and it took a while to activate originally. I was able to connect to wifi, add a google account, start updating some apps. I restarted the phone and now its stuck on "Please wait until your phone has been activated" I used the sim card that was included with the phone from the larger red card. Is there any way to reset it or activate it now?

    Snn5 speaks the truth, your sim will need to be activated. If you are the kind of person who prefers to do things on your own, though, there is one more option. If you've already created a myVerizon account, sign in to that, and there will be a box around the top middle that will ask you what it is that you want to do. In this box, type "activate or switch device" and it will lead you through the process.

  • ARGENTINA E Invoicing - ANNEXUARE 3 - 0 bytes has been transverd of 1106.

    HI,
    Can any one help me in the argentina electronic invoicing ?
    I customized the settings in proto type client just for testing i made all the required customization. But i am not able to genrate the authorization request file (ANNEXURE III). When i tried to run the program by bypassing it, it is giving me an message saying that 0 bytes has been transverd of 1106.
    I dont know what coule be the error ? The table J_1ACAE is also not getting updated...
    Can any one please suggest me if they ever worked in this kind of country specific customization.
    I will appreciate you guys if you can help me...
    Best Regards,
    Gilberto

    Hola Gilberto,
    would you please indicate exact error you receive?
    br, Guido

  • Wait until the session has been processed

    Hi folks,
    I have a report in which I create and trigger an SM35 session. I use RSBDCSUB report to do the same.
    Now, is there anyway to wait until the session has been processed? I mean, I need to do a few things in the report only after the session has been processed.
    Thanks
    Sagar

    Hi,
    You could try checking the job status (table TBTCO) inside a DO or WHILE loop.  To pause up to 5 seconds between your lookup on TBTCO, you can call function module 'RZL_SLEEP'. 
    If checking TBTCO does not work out for you, you can try the same loop logic with a call to function module 'ENQUEUE_BDC_QID' instead of looking up the job status.  If the enqueue has been released then the job has finished.
    Regards,
    James G.

  • Untill today FF has been great now when starting get firefox has stopped working message

    Windows 7 pro. HP Pavilion D3 laptop 4 gb Ram. All was good up until this morning and then FF will not open just get below error. Have uninstalled and reinstalled no joy

    Please make sure of the following:
    *All windows updates are up to date:
    *[[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    *[https://www.mozilla.org/en-US/plugincheck/ Update any outdated plugins]
    *Try a new profile: [[Use the Profile Manager to create and remove Firefox profiles]]

  • Request batch process until all data has been updated to BW

    Hai Experts,
    This is the check box available in the info package scheduing screen
    in the schedule tab.
    Why this check box is used.Can any body explain the need of this one.
    Thanks in Advance.
    Regards.
    Vikram Singh

    Hi
    If you schedule an InfoPackage later in the batch, you can specify that the background job for the request runs as long. That means it is active until all data is posted in BW.
    For example, this gives external scheduling tools the option of monitoring the request job. The job then runs with a request from an SAP source system as long as the source system has sent the data to the BW system and has posted this or until the monitor sets the request to red. In the job log, a success or error message is displayed, depending on whether the request was successful or had error
    Mannev
    Assigning points is the way to say thanks in SDN.

  • My first name has been changed to my housemates his to mine

    I found this to be the case when I logged into Apple Developer this past week ( it did not accept my original gmail account and password)
    So I logged in with my 1 & only Apple ID.
    Due to the screw up in Apple Developer, I checked that my name was correct here in,  Apple disc..umm  support communities, both my info ,
    on my settings as well as in itunes is correct and so is Kes's.
    But now in this change over my profile has me as Ed C -  I'm not Ed C, and  he is not Mia,  he's my housemate, true  we have the same address but goodness how can an apple developers error reach all the way here especial;ly after I emailed them for help.
    We both have our correct surnames.
    Can anyone please help me (us) sort this out. we are not who they say we are here I think this should be corrected here in this new apple support  site, these aren't our usernames these are our real names -  I don't think anyone should be privy to changing them.
    I'm showing my name in my settings,  his is not as his not thrilled to be called Mia or to try to navigate here at the moment.
    I'd really appreciate your help or suggestions, please note dumping my apple id is not an option, I've always only had one and I have a MBP
    that needs to be picked up under the same apple id.
    Kind regards,
    Mia / Eme

    Hi Eme,
    I've used the Report Abuse link to try get you both some help:
    Regards,
    Colin R.
    PS It really should be renamed to Report a Problem.

  • Inability to sign after first signature has been placed

    Hello,
    I have a travel expense document that once it is signed, it no longer allows the second signature field to be signed. When you attempt to add an additional signature, the field does not respond to button presses. Here is a link to the document on my Skydrive: http://sdrv.ms/OPi2Te
    I am using Adobe X. I am not sure what version the document was created with.
    Thank you.

    The signature fields are configured up to lock all of the fields in the document when signed, which includes the other signature field.

  • The screen on my macbook has malfunction. When I change the brightness to zero and return to the first level of brightness it works briefly but then the screen starts to flicker brightness and quickly extinguished.

    The screen on my macbook has malfunction. When I change the brightness to zero and return to the first level of brightness it works briefly but then the screen starts to flicker brightness and quickly extinguished. It seems to be a bad contact, it would not be normal for a quality product that should have, he has less than two years of use. Not because of the bad use or crash. Someone with the same problem or can help me? It's really a contact problem? I've done all the procedures recommended by the online support. Thanks.

    Hey everyone in Apple world!
    I figured out how to fix the flashing yellow screen problem that I've been having on my MBP!  Yessssss!!!
    I found this super handy website with the golden answer: http://support.apple.com/kb/HT1379
    I followed the instructions on this page and here's what I did:
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    I went through the 6 steps above twice, just to make sure I got rid of whatever stuff was holding up my bootup process.  Since I did that, my MBP boots up just like normal.  No flashing yellow screen anymore!!   
    (Note that I arrived at this solution when I first saw this page: http://support.apple.com/kb/TS2570?viewlocale=en_US)
    Let me know if this works for you!
    Elaine

  • Why is it that when looking through  new apps in the  apps store on my ipad in release date mode  does it return to the first 1-12 after viewing pparticular apps?

    why is it that when I look through the new apps in the apps store in release date mode it returns to the first page after veiwing more information about some apps, I could be ten to twenty pages in and have it happen.
    Also, I only speak and read English and although there are probably great apps for people from other nations, I don't want to wade through all the apps that I can't make use of. I expect that people of other nationalities or languages don't want to have to wade through every app that they can't make use of, is there not a way that alI users could filter by language?
    I mean no offence to anyone but with a collection of hundreds of thousands of apps in all languages and the jump back to the begining after possibly being into the list by a number of pages I stop looking after awhile and I'm sure I've missed some excellent apps by doing so.

    Contact iTunes support : http://www.apple.com/support/itunes/contact/

  • How to display PDF in slideshow, without returning to the first page or stall/halt on the last page?

    Hi,
    I want to display PDF's with multiple pages as a slideshow.
    This is possible with a default Adobe Reader and have this working for ONE pdf file.
    But I want do display multiple PDF's as a slideshow, the one after the other.
    In Adobe Reader you can define to return to the first page again or it automatically 'stalls/halts' at the last page.
    But I want Adobe Reader to close after the last page is displayed so it continues (in a simple DOS-script) with a second, third, etc. PDF to be displayed.
    Is this possible?
    What kind of simple DOS-script kan be used or an other reader/utility?
    Thanks in advance!
    Gunther

    Hi Bernd,
    I was looking for ways to script this kind of solution.
    But do not have good results.  There are tools to combine pdf's into one large pdf - but mostly to be selected by hand.
    We need it in a scriptable way to automate.
    Additionally, we want to be able to combine different types of documents to rotate as a slide show (so not only PDF's but also pictures or other output).
    If you or someone else have such scripts, it will be highly appreciated.
    Regards

  • How to return only the first string

    Hi Guys,
    I have a mapping where I am creating a filename from data in within my data file, I am using one of my variables i.e. Account
    The data looks like this
    Account:
    123
    123
    123
    456
    456
    456
    789
    789
    789
    What I want is to is return only the first row u201C123" and concatenate it with a constant to make up the filename.
    Any help will be appreciated.
    Kind Regards,
    CJ Bester

    very simple
    use copy value standard function like below.
    Account------->copyvalue(0)----------->
                                                                      CONCAT------------->TARGET
                                         Constant------->
    Regards,
    Raj

  • Returns to the first row executing a rollback action in ADF BC

    I have the next problem:
    1.- There is a list of rows taken form a View Object that shows 10 rows per page.
    2.- I can navigate into the list, with first, previous, next and last buttons.
    3.- Each row has an Edit button. If you press it, a new page is opened to modify the row.
    4.- This new page has 2 buttons: Save and Return.
    ... 4.1.- Save has associated an Action forward = Commit, and returns to the list correctly with the edited row selected.
    ... 4.2.- Return has associated an Action forward = Rollback, and returns to the list, but always returns to the first row of the first page in the list.
    I have followed the steps indicated in Steve Muench's document [JDeveloper and the art of the rollback|http://one-size-doesnt-fit-all.blogspot.com/2007/02/jdeveloper-and-art-of-rollback.html], but the problem is still there.
    Could anyone help me, please?

    The vital part in the method is finding the VO you are using public String dropChangesAndReturn() {
    // find the vo you are using
    ViewObject vo = ....
    Row row = vo.getCurrentRow();
    if (row != null) {
    row.refresh(row.REFRESH_UNDO_CHANGES | row.REFRESH_FORGET_NEW_ROWS);
    iterator.getDataControl().commitTransaction();
    return "SomeNavigationRule";
    }So if you know the VO find it and use the rest.
    Tio

Maybe you are looking for