Correct way to communicate with server

Ok,
I have a server program that is written in C++. The protocol for communicating is:
Command (8 bytes)| Data length or 0 (8 bytes) | Data (if any)
The command is in character form. A command would be OPEN.
This is the simplified code of what I am doing:
BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream, 12800);
byte[] ba= new byte[16];
byte[0] = 'O';
byte[1] = 'P';
byte[2] = 'E';
byte[3] =' N';
byte[8] = '0';
bos.write(ba,0,16);
This does not seem to work as the server reports data amount is incorrect. My question: What is the correct way to do what I trying to do?
Thanks for any help,
cmp2

Thanks for the reply,
I have no idea what you think you are doing with the next line...
byte[8] = '0'In my attemp to get this to work, I decided maybe it's looking for a zero. Anyway, I moved the server to another computer and it is no longer having problems receiving my data. However, it isn't sending back a correct response, at least I don't think so. So this is my simplified reading code:
BufferedInputStream bis = new BufferedInputStream(socket.getInputStream(),128000);
byte[] bi = new byte[16];
int size = bis.read(bi)
The size is 8 and the charater converted output is : O0020000. The first character matches the first one I sent.
I am expecting a command like CNAK or SNAK being sent.
Any ideas?

Similar Messages

  • In the latest iOS updates, did Apple change the way Airplay communicate with other devices through Wifi?

    Short :
    In the latest iOS updates, did Apple change the way Airplay communicate with other devices through Wifi?
    Detailed:
    We had a glitch with our Apple TV 3A 3-4 weeks ago and had to factory reset it (we reconfigured it with the exact same configuration than before the crash), it's now running iOS 7.0.2, I can't saw which version it ran before the problem though.
    It's used in a business environment with 30+ iPads 2, half of them are updated to 8.1.1 and the other half to 8.1.2. We use the latest iTunes version.
    Before the glitch that required a reset, all the iPads were detecting and mirroring when needed to the Apple TV, but now the iPads don't see the Apple TV in their list of Airplay devices anymore (but they detect various other devices inside our network).
    I have to add that our Apple TV is able to navigate the movie store correctly, so I assume that it's not an internet restriction issue from our end (also, the APple TV do not see either any of the many iPads on its device-detection screen.
    We successfully connected an iPhone 5S and an iPhone 6 through P2P Airplay, so it's not the issue, but when we connected the iPhones to our Wifi network (Same as all the other devices are using) the Apple TV suddenly disappeared from the choices.
    Hence the reason why I inquire to the possibility that some changes were made in one of the latest iOS revisions, if so, we would require some details so we can adjust our Wifi configuration accordingly to allow the proper detection of devices.
    P.S. I tried the basic troubleshooting of Airplay problems with no avail. Airplay button is displaying on the control panel, Airplay do not show the Apple TV at all (so it's not either the trick to display the Mirroring button), we also already proceeded to the suggested devices reboots, so my issue is quite more complex I believe.
    Thanks in advance.

    PhotogYogi wrote:
    I Have the same issue on a brand new iPad mini 2. My battery is only lasting up to 5 hours. I went on chat with Apple last night and they said my battery is fine and its a Safari issue. I'm literally losing 1% every 3-4 minutes. I tried recalibrating my battery, signing out of iCloud, shutting off all locations, turning off background app refresh, restoring network settings, restoring all, and finally restoring from iTunes with no luck. This is just awful. I got this iPad so I could use it on my long flight for a trip I have coming up, and unfortunately, it's not going to last that long, plus I'm concerned about how many times i will be recharging my battery because of this since battery's do have a life cycle dependent on the number of charges. This is frustrating and needs to be fixed ASAP and addressed by Apple.
    By the way, Apple told me to bring my device to the Apple Store because it's still under warranty. That's great and all, but I'm going to waste my time if there is no fix for this issue.
    Ok so you want Apple to address the problem, but yet you don't want to take it to them just in case they can't fix it? What if they can fix it? Complaining here certainly won't fix it.

  • Any way to communicate with Serial PORT using JavaScript

    is there any way to communicate with Serial PORT using JavaScript ??
    Dont tell me to do it in java because I need to this on client side not on server side.
    such as when client pressed the button, a javascript function will be called and in that function I need to communicate with the serial port of that client... That action will not go to server side.

    Is there any way to send a string of bytes to the serial port from the client side ?
    Just a button on the web page that sends out stuff to the comport.
    I was hoping to do this using java script also ..

  • How do I get a refund?  I have tried to use this converter to change a PDF to a word document or excel document three of four times and it always fails..  I want my money back but don't see any way to communicate with Adobe.

    How do I get a refund?  I have tried to use this converter to change a PDF to a word document or excel document three of four times and it always fails..  I want my money back but don't see any way to communicate with Adobe.  i really just want my money back.  Very disappointed.  Also disappointed that it is so hard to find a way to communicate with Adobe that I have to resort to asking this question in this forum. 

    You need to use the CHAT link in support to reach Adobe staff. Be sure you know the product name you are trying to cancel, Adobe have lots of products, several converters etc. I think it is ExportPDF you have, most likely.

  • HT1430 I am getting a message asking me to enter my Facebook password in the Settings. However, when I enter it, I get the message "unable to communicate with server." It's driving me crazy!

    I can't connect with the Facebook server. When I tried to connect with Facebook when playing Candy Crush, I got the message to "enter password for "" in Settings.  When I go to Settings, it says "There was a problem accessing your account. Please reenter the password for [my name]." Then, when I type in my password, I get the message "unable to communicate with server." 
    I tried deleting my Facebook account and then reinstalling it, but the problem continues. Any ideas?

    Dear Tomarshe
    I had the same problem a couple of weeks back.
    What I did was that I restarted that Ipad of mine and voila!
    Problem solved!
    hope this helped!
    - DASHdotDASHdot

  • I'm trying to set up my new iPhone 5s from a backup of my previous iPhone, when trying to enter my Facebook login info in settings I keep getting the following error message : error signing in could not communicate with server, please help !

    I'm trying to set up my new iPhone 5s from a backup of my previous iPhone, when trying to enter my Facebook login info in settings I keep getting the following error message : error signing in could not communicate with server, please help !

    Can you access other apps? Can you acess the internet? Can you access applications that use internet besides facebook?
    If answer is yes to all of these; contact Facebook.

  • How JavaFX can communicate with server?

    What is about communications with server from my JavaFX applet? Nowhere here found any of turorial or info how to support this thing. I need to develope web application, where my javaFX web app will not only makes different animations but should communicate with server very much. What approach to use in this case? Will we see here good example of how this could be managed?For now I see only client side stand-alone application.

    There are examples of JavaFX programs using Web services in the mentioned samples. For example [LocalSearch: Location-Based Coffee Shop Search With Yahoo Webservices|http://www.javafx.com/samples/LocalSearch/index.html], [Shopping Service: Accessing Yahoo's Shopping API from JavaFX|http://www.javafx.com/samples/ShoppingService/index.html], [Weather Widget: Getting Weather Forecast from Yahoo!|http://www.javafx.com/samples/WeatherWidget/index.html], and some others.

  • I can't sign into my Facebook account on my ipad2 it says go to settings and sign in but when I do it says cannot communicate with server anyone able to help please

    I can't sign into my Facebook account on my ipad2 it says go to settings and sign in but when I do it says cannot communicate with server anyone able to help please

    Here is a solution that worked for me, after nothing else would. Log out and back in to iTunes on your Mac/PC.
    I had exactly the same problems as above, and no amount of network changes or even a full restore would help.
    Finally, I went back to my PC, launched iTunes, logged OUT of that, then signed in again, this time with the new password.
    Then I had to go back, and properly close Facetime and iMessages and sign in. It worked fine after that.
    (To properly close an application, double click the home button, then hold down on the facetime app logo in the multitasking bar at the bottom, then press the tiny symbol.)
    Best of luck.

  • I want to Block iphone because he stole from me, what is the way to communicate with you, I have serial No.

    I want to Block my iphone because he stole from me, what is the way to communicate with you, I have serial No.

    Apple does not block phones. Call the police and your carrier. Change all your passwords. If you had find my iPhone enabled before the phone waa stolen, you may be able to track it, and erase the phone.

  • Is there a way to communicate with Game Centre friends?

    I was looking through the game centre, and I didn't find any way to communicate with my Game Centre friends, so there's no way?

    http://support.apple.com/kb/ht4314

  • Sir, the subject is, I do not know the original owner Will helped me know that the owner or on the way to end this problem, or any way to communicate with the person in question

    Sir, the subject is, I do not know the original owner Will helped me know that the owner or on the way to end this problem, or any way to communicate with the person in question

    This is a user to user forum.  You are not addressing Apple.  It appears that you may be having issues related to Activation lock: ( http://support.apple.com/kb/PH13695).  If you cannot contact the original owner to have them remove activation lock, you should return the device for a refund.
    HTH

  • HELP, i am unable to get Facebook to run.  I keep getting the following error:  Error signing in, unable to communicate with server.

    HELP, i am unable to get Facebook to run.  I keep getting the following error:  Error signing in, unable to communicate with server.

    >tutorial on learning PE
    Here are some links I've saved
    Saving & Sharing http://forums.adobe.com/thread/1051093
    Steve's Basic Training Tutorials... steps are the same for several versions
    -http://forums.adobe.com/thread/537685
    -v10 http://www.amazon.com/Muvipix-com-Guide-Premiere-Elements-Version/dp/1466286377/
    -All http://www.amazon.com/Tricks-Adobe-Premiere-Elements-Muvipix-com/dp/1451529724/
    -and http://forums.adobe.com/thread/498626
    -and http://prodesigntools.com/five-hours-free-tutorials-photoshop-and-premiere-elements-7-and- 8.html
    FAQ http://forums.adobe.com/community/premiere_elements/premiere_elements_faq
    TIPS http://forums.adobe.com/community/premiere_elements/premiere_elements_tips
    Another help site http://muvipix.com/ or http://muvipix.com/phpBB3/
    User Guide PDF http://help.adobe.com/en_US/premiereelements/using/index.html
    Right click PDF link in the upper right corner and select to save to your hard drive
    -the page also has links to help pages for previous versions

  • Right way to communicate with a socket server (TCP/IP)

    Hi,
    I used to write data from my J2ME socket client to a J2EE socket server with writeUTF(). In this way I can send (and receive) directly Strings.
    When I need an XML file I ask the server with something like os.writeUTF(GIVE_ME_XML_FILE) and I use an XML parser with this socket InputStream.
    I was wondering if it's the right way to proceed ....?
    How do you guys communicate with a server when you need "to talk" a lot ? Do you use only HTTP requests or (if you are allowed to) do you use Socket with writeUTF ?
    Just to know if I'm completely wrong....and if I gonna have unsolicited issues ...
    Thanks..

    AdrienD wrote:
    When I need an XML file I ask the server with something like os.writeUTF(GIVE_ME_XML_FILE) and I use an XML parser with this socket InputStream.
    I was wondering if it's the right way to proceed ....?No, it is not. Read the writeUTF api docs, and you'll know why!
    How do you guys communicate with a server when you need "to talk" a lot ? Do you use only HTTP requests or (if you are allowed to) do you use Socket with writeUTF ?There is answer to this question. it al depends on what data gets send where, how often, and how large..

  • "Unable to communicate with server error" when pasting data in in list via edit

    Hi Guys, I imported data into a SharePoint site and it seems that it made the fields in to multiline, so I had to edit each colum and make it single, but when I did that it seems that the html font code also detached and views in the record as you can see.
    So I went into edit list so I can copy and past the same data back in without having the font color html code in, but once I did that I am getting a error which isn't letting me save
    Does anyone know how to pass this error or another way to remove all these font codes in my fields names?
    Thank you.

    Hi,
    For your issue, try to do IIS Reset, compare the results.                       
    You can use compatibility mode to check whether it works.
    Open IE->Tools->Compatibility View Settings
    You can also use Internet Explorer 8,9,10 to check whether it works.
    Also, please check the SharePoint ULS log located at : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS to get a detailed error description.
    meanwhile check the following, may help:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/8142d297-d8f7-4b7a-8faa-052ecb9ae74a/custom-item-updating-throws-unable-to-communicate-with-the-server-error?forum=sharepointgeneral
    http://sharepoint.stackexchange.com/questions/94087/give-users-edit-permission-to-a-list-but-no-access-to-the-site
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/d7845547-e0f1-40de-badd-c66a34c0cfb4/the-server-was-unable-to-save-the-form-at-this-time-please-try-again
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Best way to communicate with IEEE device

    Hi everyone;
    I'm using a Magtrol DSP6001 Dynamometer Controller to control a
    dyno.  It's GPIB, and I'm able to communicate with it swimmingly,
    and I've used it it a number of other apps that I've written.
    My problem now is, that I need to be reading the device as fast as
    possible, but at the same time, setting the torque at regular
    intervals.  Here's a better explaination:
    I'm controlling a stepper motor (which is the main problem, as all the
    other motors I have written apps for using this equipment have been
    brushless servos) for an acceptance test, and part of the test requires
    that the torque be ramped up gradually until the motor starts missing
    steps, and the torque at which this happens is recorded.  The
    problem is, in order to accurately record the torque value, I need to
    be reading the device constantly (not a problem, as the controller is
    capable of providing 100 samples/second), but at the same time
    gradually increasing the torque.
    You can see where the problem arises...  if I were to multi-thread
    this vi, then I would get randomly occurring IEEE errors, but if I have
    the data acquisition in the same loop as the torque increase, then I
    don't get nearly enough accuracy.  Is this something that a
    semephore would be useful for?  I have heard something about the
    IEEE bus being able to handle some sort of syncronization, but I don't
    know much about that...does anyone else?
    Has anyone else had this sort of problem before?
    Thanks, Geoff
    Notes: I'm running the controller in open loop mode... for two
    reasons.  One, it's easier to have a smoother ramp in open loop by
    the nature of the commands used to communicate with it, and two, trying
    to obtain the PID settings for this motor was getting to be an absolute
    nightmare, and I don't think it worth the time, as it's just a ramp,
    not a constant torque.  Or am I wrong in thinking that?

    Thanks for the reply, but I suppose I should have been more clear...  it doesn't exactly answer my question.
    I have two loops, both of which need to communicate with the
    controller.  One loop (top in the image) I need to run several
    times faster than the bottom loop, as I need greater accuracy in the
    readings (more samples).
    The bottom loop will run not as fast as possible - as the top loop will
    - but will run every say, 20 milliseconds.  You might be asking
    why that's not in the image, but that's just the bare bones of what I'm
    trying to do. 
    I can't leave them to their own devices as is, since I'll get random
    GPIB errors because both might be trying to write at the same time, or
    one might write before the top has read, and then the read will return
    an error. 
    I was just wondering what the best way to go about doing this
    is...  I'll try using queues to do this type of operation, sorta
    like you suggested.
    Has anyone ever heard of GPIB being able to do synchronized
    communication?  (as in, is there a way to have two pieces of data,
    one being written and one being read, from the GPIB bus at the same
    time?  Like, being able to read what's been returned by the
    controller, but at the same time writing a new command to the bus?)
    Message Edited by Novatron on 07-28-2005 03:49 PM
    Attachments:
    Example.jpg ‏89 KB

Maybe you are looking for

  • Thunderbolt display non-functional after 10.8.2

    I recently purchased a Macbook Pro with Retina Display, along with a 27" Thunderbolt display. IT was working well until I noticed that it was no longer detecting the thunderbolt display. I suspect this is after the 10.8.2 upgrade. When I plug a TB-to

  • Error: ORA-03114: not connected to ORACLE

    While executing the database creation at the middle it is asking for password even if i give password (first attempt ) or empty enter (Last attempt)i'm unable to connect the database. Password for DBSNMP user: null [ORA-03114: not connected to ORACLE

  • IPhoto templates

    I'm about to go insane with the new iPhoto I installed yesterday. I was able to get the templates yesterday but not able to send the email I created. Kept getting a password question and getting rejected. Today I went to share and cannot get to the t

  • Window 7.8 update

    Is window 7.8 update available for lumia 710. & if available then on updating my data will remain safe or not. Solved! Go to Solution.

  • Is there a keyboard shortcut to jump directly to a particular full screen app in Lion?

    When you full screen an application in Lion, it "flies out" of the desktop space it started in, and winds up at the end of the spaces list (assuming you have turned off auto-arranging). As a result if the app being pulled out of the spaces flow, ther