Low Level SSL read is not working !

Hi,
I can readLine() from a buffered SSL socket without any problems.
But I can't get the last line because the last line does not contain any <CR> or <LF>.
So, when I try to do a low level read from a raw SSL socketstream, I always get "zero bytes available" even though there should be bytes to read.
Please help.
InputStream in2 = serversocket.getInputStream();
while (true) {
     num = in2.available();
     if (num > 0) {
     buffer = new byte[num]; // allocates memory buffer
in2.read(buffer,0,num);
     System.out.write(buffer,0,num);
     System.out.flush();
     try {
               Thread.sleep(500);
          } catch (InterruptedException e) {
                         e.printStackTrace();
What did I do wrong?

I can readLine() from a buffered SSL socket without any problems.
But I can't get the last line because the last line does not contain any <CR> or <LF>.So send it, or don't use readLine().
So, when I try to do a low level read from a raw SSL socketstream, I always get "zero bytes available" even though there should be bytes to read.So don't use available(). It's not guaranteed to return anything other than zero, and in SSL it doesn't.
     num = in2.available();Pointless. Remove this line.
     if (num > 0) {
     buffer = new byte[num]; // allocates memory bufferAllocate a buffer with a fixed size, outside this loop.
in2.read(buffer,0,num);in2.read(buffer);
     System.out.write(buffer,0,num);Correct.
     System.out.flush();Do that outside the loop.
               Thread.sleep(500);Completely pointless and literally a waste of time.
What did I do wrong?Almost everything. Try it with the corrections suggested.

Similar Messages

  • CD/DVD reader is not working, please help.

    My cd/dvd reader is not working at all, when I put any cd or dvd on it, the led of the reader starts blinkin but then it stops and nothing happens. I'm using a hp pavilion dv7-1025nr, windows vista 64-bit. Maybe there are some drivers that i should download, in that case, can some one help me with link?, Thanks.

    When you access this page from the link, ensure that this is your machine by entering your Model # and then trying your Product # (both on the Service Tag on the bottom of your computer). This will confirm your Model#/Product# for future updates.
    HP Support & Drivers Page for Your Machine
    Sig: Pavilion Model Series# dv9500t (t=Intel)_CTO_Prod# RL653AV_Vista Ultimate (64-bit)_SP1_Intel 2 Duo CPU T7500_2 GB Ram_BIOS F.09_NVIDIA 8600M GS_200GB 7200RPM SATA Dual HD (100GBx2)_HP 300GB HD USB Kit for xb3000_8/2007

  • After upgrading, Adobe reader is not working.

    After upgrading to 10.10.2, Adobe reader is not working. It is asking for user agreement to be signed. I cannot find this again. I have uninstalled and re-installed but still does not appear. I have tried to contact Adobe with no luck. Can anyone help please?

    Since you are running OS X 10.10.2, you do not have an iMac (PPC) so you have posted in the wrong forum. I have requested the Hosts to move your post to the correct forum where hopefully someone will see it and help you.

  • Adobe reader will not work with games

    adobe reader will not work with games

    That is correct. Adobe Reader is intended for viewing PDF files, not for playing games. Perhaps you are thinking of Adobe Flash Player?

  • When I click PDF file, the file does not open and  installation software for creative suite automatically begin to start. Even after re-installation of creative suite 5.5, only acrobat reader dose not work and the same phenomena occurs.

    When I click PDF file, the file does not open and  installation software for creative suite automatically begin to start. Even after re-installation of creative suite 5.5, only acrobat reader dose not work and the same phenomena occurs.

    Did you ever install Acrobat? It is not installed automatically with CS, but requires an extra installation step.

  • I have a hp pavilion dv4-2160us and the dvd/cd reader is not working. it can't detect the disk too.

    I have a hp pavilion dv4-2160us and the dvd/cd reader is not working. it can't detect the disk too. i've done everything on the hp website to fix it (reinstall the driver, etc.), but nothing seems to help.  can anybody help me with my problem? thanks!

    When you say DVD drive is not working and cant detect disks, Is the Optical drive listed in Device manager and My computer? Is not reading any specific disks or all kinds of disks ?
    Also have you tried all possible troubleshooting steps found over here
    //Click on Kudos and Accept as Solution if my reply was helpful and answered your question//
    I am an HP employee!!

  • Tun miniport adapters are not working and the camera card reader is not working on a T61P.

    The Microsoft tun miniport adapters #4,2, and 3 are not working.  They display code 10 error message. Also the USB  mass storage device (camera card reader) is not working. 
    I have tried to uninstall and update the drivers to no avail.  I have used ThinkVantage Tool Box.  It only lets me know that they are not working.  It does say to reinstall them.  I have tried.  All effort has failed.
    All was find until I ran several updates via ThinkVantage.
    All suggestions would be appreciated.
    Thank you,
    Tom

    You will not lose data if you back up
    Worth doing the basic troubleshooting
    Reset
    Restore  best as new since you have issues ,then you will know if it has started to function correctly ,if not .....
    Visit Apple store since if it isn't software probably iPhone is on it's way out

  • Satellite C850-B635 and Win7 - card reader is not working

    My notebook came with windows 8 and the card reader was working
    but I installed windows 7 64-bit , downloaded all required drivers to my notebook , but the card reader is not working now .
    I downloaded a driver called card reader controller but it didn't work as well
    I don't know if there is a problem or there is a driver that I should install and I don't know .
    please help me solving that problem .
    In my windows device manager these devices isn't recognized :
    *PCI simple communications controller
    *SM Bus Controller
    *Unknown Device
    I tried to search in my drivers download page in Toshiba website but couldn't find these
    please help me making my card reader working again.
    Regards
    Message was edited by: domaking

    To me the case is simple and the reason why the SD card reader does not work is that an compatible driver isnt installed.
    My theory seems to be correct since the SM bus controller and PCI simple communications controller appear in the device manager and I guess one of these devices belongs to the SD card reader/controller.
    I think you should simply install this Realtek Card Reader Controller which I found on the Toshiba EU driver page
    http://support1.toshiba-tro.de/tedd-files2/0/carc-20130924161048.zip
    Furthermore you should install all other Win 7 drivers as well as Toshiba tools available for Satellite C850 series.
    Very important is the chipset driver, USB 3.0 driver (Win 7 needs this driver to control the USB 3.0 port), display driver. etc
    Not very essential tools are Bulletin Board, Online Product information, Reeltime, etc such additional tools dont improved the notebook performance so its up to you if you want to use these software parts

  • Since I installed lion, my SxS Card reader is not working any more. Some advise?

    since I installed lion, my SxS Card reader is not working any more. Some advise?

    Try resetting the PRAM https://support.apple.com/kb/HT1379

  • Installed Photoshop Elements. Card Reader still not working.

    Installed Photoshop Elements. Card Reader still not Working.

    And what does any of that have to do with Adobe software? You better check your hardware setup and install the proper driver for whatever card reader you use...
    Mylenium

  • HELP!!! My Card reader is not working!

    My card reader is not working and this is extremely frustrating when trying to transfer data from one device to my my macbook pro.  Is there any one out there that can help me with this issue?

    Some people (me included) have found the problme to be a stuck contact inside the socket on the MacBook Pro.  The far left contact appears to get stuck in the "inserted" position (depressed) and fails to signal to the computer that a new card has been inserted.  This contact is partially hidded behind an alignment key molded into the socket.  One fix is to carefully (and I mean carefully) use a toothpick to gently prod the contact into its "not-inserted" position (it will pop up and work afterwards).  If you aren't comfortable doing this yourself, you can get an inexpensive card reader that connects via USB as a workaround.
    If the computer is still under warranty (or you have AppleCare), take it in and let Apple or an AASP fix it for you.

  • SD card reader is not working in my MBP early 2011. Is there any solution?

    SD card reader is not working in my MBP early 2011. Is there any solution?

    on my macbook iphoto didn't recognise my camera or card reader after upgrading to iphoto '11,
    Evenutally I went to an application called Image Capture which I seem to have already.  This read the camera contents.  I selected the images I wanted and then imported them into iphoto which was one of the options given.  It worked.  God knows why one has to go through two steps.  But I'm feeling pretty triumphant. This may help you if you haven't already sorted it.

  • Numeric key pad is not working, card reader is not working

        Numeric key pad is not working, card reader is not working, 

    Did you (or someone else) physically open the laptop case?
    If you did, then some cables might have gone loose inside.
    If you didn't, for the card reader, check if appropriate device drivers are installed in windows device manager.
    for the numeric keypad, first tap once on the NUM LOCK key and check.
    If this doesn't solve the problem, boot to "Safe mode", and check.

  • Satellite X200 and Windows7 (32bit) - Card Reader is not working

    Hi All,
    Hope someone can help.
    My X200-219 has recently been upgraded to Windows7 and although it is running well, (better than with Vista for now anyway), the card reader is not working.
    Do I need a driver installed??
    Looked at various but can't find anything obvious??
    Cheers and thanks
    DB

    Hi
    Try please to install THIS driver .
    It is Vista 32 bit driver for Digital Media Card Reader. I hope it will work.
    Send some feedback.

  • My finger print reader is not working and this unknown driver is not installing HP4230s

    my finger print reader is not working and i have tried the downloads available on hp website and many other but its not showing in the area where we configure the passwords for the pc
    and my other problem is as i have updated my pc to win 8 or 8.1 this device is not getting installed the hardware id is : ACPI\VEN_HPQ&DEV_0004
    kindly solve these problems as i really want to use this finger print and i dont know what is this unknown device all about

    my hp envy mp notebook fingerprint is not working, give the software for it !

Maybe you are looking for

  • Issue with minor substitution in sql

    I have spend a lot of time trying to get this to work but no joy. I am using sql developer and the db version is 10.2.0.5 Your help and contribution will be greatly appreciated. It is a long sql and I am just pasting the FROM statement as that seems

  • How to truncate a field in a Select Query

    Hello Gurus, I am new in SAP, i have a question i am making an appointment letter in SMARTFORMS , in global declaration (initialization) i am using a select query SELECT SINGLE BET01 FROM PA0008 INTO G_BET01 WHERE PERNR = WA_PERNR. where BET01 is the

  • Mobile workstation needs

    Hello all, Im new to the Adobe forum and have some questions regarding  mobile workstation needs.  I have grown very accustomed to using laptops and in the next month going to acquire a new machine. First off all, I dont want to offend those that use

  • ARCHIVELOG mode needless for offline (cold) backups ?

    When I read some tutorials or comments about backup with rman or expdb I saw often the recommendation to put database in ARCHIVELOG mode. But this is from my point of view useless when I do such a backups in offline mode. I want to backup the current

  • Why have Apple iCloud a solution that causes more problems than it solves?

    Dear All, Steve Jobs once said that the launch of MobileMe wasn't Apple's Finest Hour" I have a sinking feeling that with the captain absent the ship has begun to drift off course. Why has iDisk been dropped, why has Syncing accross your macs been di