DataInputStream / DataOutputStream  - PS  How do i offer my duke dollars?

I have written a client server program. The client program establishes a URL connection to a ServerSocket. I am using a DataOutputStream to pass a large amount of data back to the client. The problem is that it appears that every now and then a byte is skipped or lost. Here is the important part of the code. (psudo) This loss appears to happen when I read the bytes into the Buf Array.
On the ServerSide :
DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(os));
while (notcomplete){
       dos.writeInt(acuiredInt);
       dos.writeLong(acuiredLong);
        byte[] acuiredBuf ;
        for(int i=0; i < acuiredBuf; i++)
                  dos.writeByte( acuiredBuf) ;
On the Client Side
DataInputStream dis = new DataInputStream(new BufferedInputStream(os));
while (notcomplete){
       dis.readInt(acuiredInt);
       dis.readLong(acuiredLong);
        byte[] acuiredBuf  = new byte[1024];  //always the same size
        for(int i=0; i < acuiredBuf; i++)
                  dis.readByte( ) ;
}I know that one byte is being lost because I tried to send the same int value acros constantly, and then instead of calling readInt, i called readByte four times (four bytes of an int) , and gradually everytime the mysterios 'loss' happend, the values would shift. See my example:
1 => 0 , 0 , 0 , 10
2 => 0 , 0 , 10 , 020
3 => 0 , 10, 152, 102
4 => 10 , 82, 152, 102 etc.
1 <= This displays lets say 500 times and is the correct Representation of the int then...
2 <= The "020" is not correct, it should be like the line above it. This means that the first 0 has disapeared. (But when i check the last entry in the Buf, the 0 is there) . Afer even some more time it becomes the 3rd line. and the first two zeros are the last two entries in the Buf array.
So i dont' know if i'm losing information? Using the streams wrong, or how to fix it. All i want to do is pass a large amount of information from the server to the client.
Any help would be greatly appreciated.

I know it is not the real code, thats why i said it was psueudo code, because it. For a better explanation of the problem please could you check:
http://forum.java.sun.com/thread.jspa?threadID=707296&tstart=0

Similar Messages

  • How do you add Duke Dollars to a post???

    How do you get the little Duke Dollars thingy to show up next to your post? There are no buttons to do so on the page where I'm ttyping this, nor on the preview page. Nor does it say anything about it in the Duke Dollars FAQ.

    Oh never mind! I saw the option to add Dukes appear after the message was posted.
    IMHO you should be able to add Dukes either on the form or the preview page.

  • My iphone apps shows price in indian rupees but not in dollars. My selected region and address is USA? How can i change it to dollar again

    my iphone apps shows price in indian rupees but not in dollars. My selected region and address is USA? How can i change it to dollar again

    my iphone apps shows price in indian rupees but not in dollars. My selected region and address is USA? How can i change it to dollar again

  • How do you award duke dollars

    How do you award duke dollars

    At the top of your post, ther will be an option to "Assign" duke dollars. Once you assign them to your post, you will see an option to "Award" duke dollars in the header of the replies to the post.
    Why don't you assign a few to this post to witness that! :-)
    Kamran

  • HT1766 I added storage and paid for it after I got an email that said it was expiring. Now I get an mail you are extending. How can I get my 40'dollars back??????

    I added storage and paid for it after I got an email that said it was expiring. Now I get an mail you are extending. How can I get my 40'dollars back??????

    Call Apple and ask.  We're users here and cannot help you.

  • HT4972 How do I change currency from dollars to euros as I am in ireland

    How do I change currency from dollars to euros as I am in ireland

    I meant in the apps store

  • How can I offer individual password protected pdfs on my site.

    I am building a site for a client of mine.  His business is a music talent agency.  He would like that on the page of the individual artist, there be a link to download a pdf that only that artist can download if he/she enters a correct password.  I think from reading other posts that I can simply offer a pdf download link and have that pdf password protected when I initially create the pdf itself in adobe acrobat.  Are there other ways of doing this or is that the best route to go?  All responses appreciated.

    Hi,
    For protecting PDFs, I am afraid you do need Acrobat, and here's how you accomplish applying password protection: http://tv.adobe.com/watch/acrobat-tips-and-tricks/protecting-your-pdf-using-a-password/
    With this approach, you may have to reassign unique passwords to PDFs and ensure right passwords are communicated to the right people (there is not sign-in option) - that may be a bit of challenge.
    Alternatively, with some basic scripting you could allow right people to download the right PDFs. This will need some mapping at the DB level.
    Or, you could also leverage social media and use the OAuth mechanism to ensure that the users log in via social sites to download PDFs that are unique to them. Look forward to your thoughts.
    Regards,
    Suhas Yogin

  • How can I offer "creative cloud"?

    Hi,
    I am from Paris, France. I am not personnaly interested in any Adobe products. But my brother is a lot since he is an illustrator (amateur). He would like to shift to the second gear, improve his digital skills and he is considering buying a licence for an adobe product. But even "creative cloud" is too much expensive for him. Then I decided to offer him the subscription as a gift. I can handle for him actually :-).
    I didn't try to go through the purchase process yet. Is it possible to order the "creative cloud" stuff and still "redirect" the recipient to my brother name and its computer? How does it work?
    Regards
    Yves

    Hi Yves,
    Purchases are done using a credit card and you can join Creative Cloud on a month to month basis. You could pay for your brothers membership as a gift.
    Hope that helps,
    -Dave

  • How to disable offer termination notification in irecruitment

    Hello,
    We have several notifications setup in iRecruitment which are working fine. We are looking to disable notifications when an applicants application or offer is terminated or withdrawn. Is there anyway to do that?
    Thank You
    --Kumar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    You can't unless you jailbreak.

  • My iPhone 5 has flickeringlights apple cannot repair it or replace it even though I am under the warranty period as I bought my my phone in Ireland and now I am in Australia.how can apple offer worldwide warranty and not do anything about it ?

    Why does apple cannot repair a phone or replace it is still under warranty even though it is bought from Ireland and make is of USA be coz the warranty is worldwide.what should I do ,I have talked to AppleCare in Australia as well as Ireland and they couldn't help.any hope for this question please?

    ckuan wrote:
    You have to send it to a friend/relative in the US and have them bring tt to an Apple Store for warranty purposes.
    FYI: It was purchased in Ireland.
    Not looking to start a big debate over this.
    Note that under the warranty,
    "IMPORTANT RESTRICTION FOR iPHONE AND iPAD SERVICE.
    Apple may restrict warranty service for iPhone and iPad to the country where Apple or its Authorized Distributors originally sold the device."
    It does not state they WILL NOT service in another country.
    Likewise, nowhere does it state it MUST be serviced in country of purchase.
    Also;
    "Service will be limited to the options available in the country where service is requested. Service options, parts availability and response times may vary according to country. You may be responsible for shipping and handling charges if the Apple Product cannot be serviced in the country it is in. If you seek service in a country that is not the original country of purchase, you will comply with all applicable import and export laws and regulations and be responsible for all custom duties, V.A.T. and other associated taxes and charges. Where international service is available, Apple may repair or replace Apple Products and parts with comparable Apple Product and parts that comply with local standards."
    This paragraph would not be here if it was only as simple as "service is only available in the original country of purchase".
    Soniafromire,
    I'd press the issue and see if they will send it to the country of purchase for service if you pay these fees.

  • How can I spent 0.74 dollars on itunes store ,so i can change Of country

    I have 0.74 dollars and i want to change of country on my ID but i cant change until y spent the money i have left how can i spent 0.74 or can i cancel the Account and create another one with my same mail??

    Unless you have a credit card in the country you're leaving so that you can buy something more expensive than the balance you have left (the iTunes Store would use up the balance and charge the remainder to your CC), you'll need to ask the iTunes Store for assistance. Go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store.
    Or you can just open a new account in the iTunes Store in your new country. That would require a different email address, though.
    Regards.

  • How do I put a permanent dollar value in a numeric field?

    I'm setting up a simple order form in Adobe Livecycle Designer with UnitPrice, Qty and Total columns.
    I need to have permanent dollar values show in the UnitPrice numeric field. When they enter a qty, it will be calculated by the unitprice and give a total. I have already figured out the other calculations, just can't work out how to put the dollar values in the unitprice field. They must be showing when the person opens the pdf file. Can someone pls help, I have looked thru all the posts and couldn't find an answer.
    thanks in advance
    KerryDun

    I need the numeric field to show the actual price eg $3.50 and it needs to stay there, it's not editable. To get around this I have put a text field column next to the unitprice column, to show this value, but the filler will have to type the unitprice in again, in the unitprice column so it will make the calculation of unitprice x qty = total(when the price is already sitting there.)There must be a better way to do this. Any help is greatly appreciated.
    thanks
    KerryDun

  • How do i get my 300 dollars worth of songs back

    I got a new computer because my harddrive chrashed and when i tryed to buy a new song i lost everything and i had $300+ worth of music and music vidoes how do i get that back?

    See this article about using iCloud to redownload your past iTunes purchases.
    http://support.apple.com/kb/ht2519
    B-rock

  • HT201303 How can i use the 10 dollar credit from one apple accont on another

    I have purchased an apple itunes 10 dollar card and it doesnt allow me to make a purchase with the credit instead of with my debit card

    Why do you say this?
    It actually charged your credit card?
    or did it simply ask to verify your billing info?
    Does your credit show in the itunes store?

  • How are duke dollars distributed?

    Hi all,
    I wonder.... For the last 2 months, I replied on several messages with Duke Dollars on it. But those Duke dollars were never attributed to anyone. Very often there wasn't even a feedback from the person that posted the message.
    What happens with those dollars?
    Marc

    Don't let others fool you.
    I am collecting all unassigned dukes. Just post the
    threads you have been answering and I'll make sure you
    get those dukes (charging only a small fee).Don't trust him! He said he would collect for me but instead he intimidated the user into giving him all their Duke Dollars!

Maybe you are looking for

  • How do I use DVD sharing using ethernet only?

    Hi All I am trying to set up DVD sharing between my Home PC and macbook. My PC is running Windows 7 Pro x64. I want to use the DVD on the pc to run on my mac. The thing is I only have an Ethernet cable and am a complete noob when it comes to this kin

  • How do i return to a previous system after updating?

    After trying to update our IMac to improve how it runs, we are unable to go back to our saved previous system. the entire computer is now set up differently and has none of our information on it. I think it's even running an older OS. I see all of ou

  • SHOW ALL / HIDE ALL BUTTONS produce error in chm but not in "View Selected Item"

    My SHOW ALL and HIDE ALL buttons work in the View Selected Item mode. However, the compiled version generates an error tag: Line: 72 Char: 1 Error: Object expected Code: 0 URL: mk:@MSITSTORE:C\Documents%20and%20Settings\glenn_michaels\RoboHelp%206.0\

  • Mavericks upgrade annoying display message

    After upgrading to Mavericks from Snow Leopard my desktop displays the filename  and path of the delected desktop image, this occurs only in my main user account, same on dashboard, this is really annoying, any ideas? I need help, thanks in advance

  • Photoshop dosen't work (hangs-up), if I use the stamp or similar

    Hello, I hope, someone can help me. I made the update to OS X10.10 on my Mac Book Pro and now, the Photoshop Elements 12.1 software hangs up if I select the tool paint brush or stamp or similar. I have made a reinstall of Photoshop, but the fault is