DataInputStream communicating over the socket BUT reading Garabage

I have written client/server applications. The client is written in Java and the Server in c++. There is a problem when I send data from the server to the client. Initially, I can recieve the data fine, however on the second read, I start to get all these garbage values. I'm not sure why this could be. Here is a look at the Java code. ostream1 and istream1 are used from the DataInputStream class. Can anybody give me any suggestions. Thanks.
     addr=Address.toString();
     ostream1.writeLong(addr.length());
     ostream1.writeBytes(addr);
     ostream1.flush();
while(istream1.readInt() != -100000); //used as handshake with c++
ostream1.writeLong(-9999); //used as handshake with c++
ostream1.flush(); //two previous lines work fine.
w=npanele.getWidth();
     h=npanele.getHeight();
     ostream1.writeLong(4);
     ostream1.writeLong(w); //send the width and height in pixels
     ostream1.writeLong(h);
     ostream1.flush();
while(istream1.readInt() != -100000); //starts to read garbage here
//never reads the -100000 sent by the server.
ostream1.writeLong(-9999);
ostream1.flush();

No, that cannot be it because it reads in all the previous information fine. And I used the same data types through out my code. It seems as though java client and c++ server are not synchronized with one another. That is why I check for the -100000. It's a sort of handshake implementation.... I send one long value from c++ and then in the java code I had to call the readInt() in a while loop as opposed to calling it just one time and getting the correct value which is what should happen. It calls the readInt() function maybe 12 times before exiting the program and everytime it calls the function, I get some wierd value. Anyway, I guess I will just keep on running thru the code until I can figure out what's going on.

Similar Messages

  • I received a low ink warning on my mac for my epson artisan 837 printer. I replaced the cartridge that was low but it still reads low ink on the mac but reads full on the epson control panel. I am also receiving a communication error between the mac

    I received a low ink warning on my mac for my epson artisan 837 printer. I replaced the cartridge that was low but it still reads low ink on the mac but reads full on the epson control panel. I am also receiving a communication error between the mac

    What exactly is the error?
    And, we'd need some info re. your Mac model and OS version - you are not running iOS on it.
    You need to realize that this model has been discontinued and the last driver updates are dated about a year ago. If you are running Mavericks, there may not be an updated driver for it. But you can try to delete the printer and add it again to see if that will work.

  • HT203167 I have purchased lot of music over the years, but I cannot find them in my iTunes account

    Hey, I cannot find my music in iTunes - I have purchased loads over the years but it isn;t there? shouldn't ALL purchased music be there in my account?

    Using iTunes 11.0.1. Although listed in recent purchase in the Store, I cannot find the album on my MacBook Pro. And I cannot find any option to sort the library by "Date Added."

  • Drawing a curved line using the pen tool, dragging the text cursor over the line but will only give me a small area to write in, in-between a circle and a circle with a cross in?

    Drawing a curved line using the pen tool, dragging the text cursor over the line but will only give me a small area to write in, in-between a circle and a circle with a cross in?

    If you change your tool to the "Direct Selection Tool" (A) then you should be able to adjust the area for you to type in...

  • I want to install an old airport express, the ones which are directly plugged into the socket - but it does not work with Maverick or Snow Leopard - can I configure it with a windows pc?

    I want to install an old airport express, the ones which are directly plugged into the socket - but it does not work with Maverick or Snow Leopard - can I configure it with a windows pc?

    The Mac running Snow Leopard should be able to configure virtually any version of the AirPort Express.
    Tell us what steps that you are taking to configure the Express and what happens after each step.

  • HT1296 cannot sync the calendar on my ipad mini with my main imac computer. the settings on itunes say that my ipad is syncing over the air but it is not unfortunately. i cant see how to change the settings if need be. would appreciate help. thanks

    i canot sync the calendar on my ipad mini with my main imac computer. the settings on itunes say that my ipad is syncing over the air but it is not unfortunately. i cant see how to change the settings if need be. would appreciate help. thanks

    i have done this on my ipad mini and my imac but they are still not syncing. my iphone 4 has the icloud symbol but it seems to be unresponsive to touch, I cannot get it to highlight or turn-on. Bit confused.

  • I can not set up my airport extreme, he's worked over the internet but I can not back up

    I can not set up my airport extreme, he's worked over the internet but I can not back up

    ''donngra [[#answer-685379|said]]''
    <blockquote>
    ''FredMcD [[#answer-685331|said]]''
    <blockquote>
    Your System Details shows;
    Installed Plug-ins
    Shockwave Flash 15.0 r0
    Shockwave Flash 11.5 r502
    Having more than one version of a program may cause issues.
    Grab the uninstaller from here:
    '''[http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html Uninstall Flash Player | Windows]'''
    '''[http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html Uninstall Flash Player | Mac]'''
    Then reinstall the latest version.
    Flash Player '''v16.0.0.296<br>https://www.adobe.com/products/flashplayer/distribution3.html'''
    Shockwave Director '''v12.1.6.156 http://get.adobe.com/shockwave/'''
    </blockquote>
    </blockquote>

  • HT1296 my itunes say that my contacts are being synced over the air but nothing is happening??

    I've just upgraded to a 4s and I am trying to get my Outlook contacts synced with my phone. My itunes says my contact are being synced over the air but nothing is happening. can anyone tell me what i'm doing wrong or how to sync with the phone? thanks

    Hello there, eocrbhll.
    The following Knowledge Base article should be helpful:
    iOS: Syncing with iTunes
    http://support.apple.com/kb/ht1386
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro D.

  • I recently used the computer for I player over the TV, but when removing the external speakers the internal speaker appears to have stopped working and when going on to system preferences and sound I am only given the option of digital out put. Help

    I recently used the computer for I player over the TV, but when removing the external speakers the internal speaker appears to have stopped working and when going on to system preferences and sound I am only given the option of digital out put. Help

    Do you see a red light shining in the headphone port?

  • SAP PCK communication over the internet

    Dear All,
    Could you please give detailed information on SAP XI PCK and SAP XI communication over the internet?
    1. I know there are few certificate issuing authority like DUNB..etc.
    2.How SAP will identify the SAP PCK on WWW? will unique ip will be given to both the system.
    3. If we need to contact these certificate,issuing authority,then how to proceed about it.
    Thanks & Regards,
    Himanshu Gaur

    Hi Himanshu,
    Please check the following links, they talk about  Communication Between SAP XI Landscapes:
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/d7d43fb9490c65e10000000a114b1d/frameset.htm
    also Integrating Smaller Business partners with PCK:
    http://help.sap.com/saphelp_nw04/helpdata/en/32/92e5bced6cb441af4360cfcb8142f3/content.htm
    and,
    PCK Highlight:
    http://help.sap.com/saphelp_nw04/helpdata/en/99/115281baba404890d2561617a78409/frameset.htm
    I hope it helps,
    Thanks & Regards,
    Varun Joshi

  • How do I keep the name tags in Picasa Web Albums from appearing on the images by default? With Explorer, name tags only appear when mousing over the image, but with Firefox, all the tags appear on the picture as soon as it is loaded, which looks messy.

    I use Picasa to create web albums, and I tag people who appear in the pictures. With Explorer, the name tags do not appear on the pictures until I mouse over a specific person, at which point the tag appears. With Firefox, the name tags appear as soon as the picture is loaded, and only disappear when you mouse over the people in the picture. This makes the picture look messy; by default, one would want to see a picture without tags all over people's faces.
    The only way to "fix" this is to disable the name tags completely (or tell people to use Explorer!), but this is not an ideal solution, since I would like to be able to share albums with people's names in them.

    I use Picasa to create web albums, and I tag people who appear in the pictures. With Explorer, the name tags do not appear on the pictures until I mouse over a specific person, at which point the tag appears. With Firefox, the name tags appear as soon as the picture is loaded, and only disappear when you mouse over the people in the picture. This makes the picture look messy; by default, one would want to see a picture without tags all over people's faces.
    The only way to "fix" this is to disable the name tags completely (or tell people to use Explorer!), but this is not an ideal solution, since I would like to be able to share albums with people's names in them.

  • PSE 12 won't save the tiff file over the original, but brings up save as window

    I've solved (or had help) solving this problem before:
    http://forums.adobe.com/message/5893872#5893872
    I am using PSE 12 as a photo editor for Aperture 3.5.1 and the photo is duplicated (as a tiff) in Aperture and PSE editor opens with the image.  When I close the file and say to save the file it brings up the save as window.
    The fix from the earlier discussion worked fine at first, but now, even though I tell PSE 12 to "on first save -- save over current file" it now brings up the "save as" window and won't save over the file (changes the file type from .tiff to .tif)
    Has something changed?
    Dave

    Go to the editore preferences>general, click this button and restart the editor, then try again (You will need to reset the saving files pref first):

  • Enable ESS over the internet but not the MSS

    Hello gurus!!!
         I have a few questions that I need to get clarified. We have a Portal server and we installed ESS and MSS business packages on it. Now, our requirement is that we just need to expose ESS applications over the internet and not the MSS applications. When a user gets logged into the portal, the user might be assigned a MSS role and also an ESS role. But when this user tries to login to the portal away from work (ie over the internet), the user should be denied access to the MSS applications but should be allowed to access only the ESS applications.
    How can we enable this on one portal server?
    Thanks a lot!!
    ~~~LB

    I know its not my Network or ISP because I have RealVNC Enterprise connecting with no issues internally nor outside of my network and it uses the same VNC port 5900 so it can't be that.
    ARD only uses port 5900 for observation and control. For other functions ARD uses port 3283. So you may need to open and forward that port as well, or verify that your ISP and other locations aren't blocking.
    Regards.

  • Upgraded to iTunes 11...now insists on syncing contacts/calendars 'over-the-air' but can't change settings

    Upgraded to iTunes 11, at which time it decided it was better for me to sync my calendar/contacts "over-the-air" from iCloud (when I never had this activated before).  Now it says "your contacts are being synced with your iPhone over the air from iCloud" (which is not true...it doesn't work and changes in one place are not made in another - same goes for calendars).  Also states "Over-the-air sync settings can be changed on your iPhone" (likewise not true...I've got them deactivated in my iPhone and still doesn't work).
    Not sure why Apple thought they should go ahead and change my preferences that were setup to go to iCloud, especially when it doesn't even work.  Now no contact or calendar changes I make in Outlook transfer to iPhone or vice-versa (even with a manual sync).
    Anyone know what the h*ll is going on with this?  To say I'm annoyed would be an understatement.  May be time to ditch Apple and the iPhone, first no YouTube & Google Maps now they insist on not allowing me to sync the way I want.  Total BS.

    I have this same problem too - thanks for the heads up that all my NOTES will get wiped.  Going to have to workaround by dumping all my notes from Outlook to ONENOTE on the cloud.  Then not really using NOTES on my iPhone and iPad.  Apple is slowly becoming more and more successful in getting me to NOT use MS products, like Outlook.  Actually, my cloud strategy will be to keep my longer notes on ONENOTE and relegating NOTES on iPhone/iPad to just quick hits that I jot here and there.  I guess iPhone/iPad notes will then get synced over iCloud but will not end up in Outlook.  What a pain in the arse!  I need a seriously freaking flow chart to keep track of all of my cloud activity.  It's making my head spin.

  • Synchronous communication over the internet

    Hi Experts,
    I need a server-client based application model which:
    - communicates over the Internet (both server and client could be behind a firewall/router).
    - is capable of passing objects by reference (like Java's RMI-JRMP/RMI-IIOP).
    - can handle client side call-backs.
    - is part of the standard Java API.
    I thought about RMI-IIOP.
    Can RMI-IIOP handle all of the criterias in the list?
    Is there any other way to implement such an application in Java?
    Thank you very much in advance!

    ejp wrote:
    - is capable of passing objects by reference (like Java's RMI-JRMP/RMI-IIOP).That is meaningless and impossible.That is meaningful and possible and implemented since Java 1.1 for remote objects which have been exported. That is the essence of RMI and RMI/IIOP.Nope. No way to move the actual instance of an object from one application to another.
    Conceptually it is. Which is exactly what RMI does. And exactly what I meant.
    - can handle client side call-backs.That doesn't make much sense. Did you mean server side call backs? Where the server is attempting to initiate (start) a connection with a client? If so that is almost always a bad idea.A callback is a callback into the originating client. I don't know why you're making such a fuss about that. I wouldn't call it a server-side callback myself.Because there is no need to differentiate that requirement unless it means something different than a standard type of RMI call.
    Then you are going to need to write a lot of code for a real application.
    Nothing canRMI and RMI/IIOP can do all that. They can do everything the OP specified except callback through client-side callbacks, and there are commercial solutions available for that.Again - moving the instance. Not the data. Not simulating it via a behavior interface.

Maybe you are looking for