C++ can send a "struct" over TCP.How to do the same fuction with JAVA?

as Title~
C++ send a struct like the following...
NEO_MSG neo_msg;
struct NEO_MSG
int iPortRecv; // port for recv data of client
char verify;
////After create a TCP connection....
send(ServerSock, (char*)&neo_msg, sizeof(neo_msg), 0);
How to rewrite it with JAVA?

If you are trying to do it in a way that is compatible with C++, then you'll need to write the bytes to the socket. You can do this by wrapping the socket's output stream with a DataOutputStream, then writing each value in order.
Remember that a C++ struct is just a convention of accessing a linear array of bytes, so the above is equivalent.
If you are just trying to send an Object's data over a socket (to another Java app), then you can wrap the socket's output stream with an ObjectOutputStream, then just write the object to it.
- K

Similar Messages

  • How to register the same schema with same URL

    I'm getting ORA-31085 error when try to register the same schema with same URl.
    My requirement is that I should be able to reregister the same schema with the same URL .
    I'm using the following function :
    PROCEDURE validateXmlSchema(inp_xmlMsg IN VARCHAR2,
    out_isValidDoc IN OUT NUMBER,
    inp_xmlSchema IN OUT VARCHAR2,
    out_varchar_notused OUT VARCHAR2)IS
    xmldoc XMLType;
    res number;
    BEGIN
    xmldoc := XMLtype(inp_xmlMsg);
    res := xmldoc.isSchemaValid(inp_xmlSchema);
    IF (xmldoc.isSchemaValid = 1) THEN
    out_isValidDoc := 1;
    ELSE
    out_isValidDoc := 0;
    END IF;
    END validateXmlSchema;
    This is used recursively.Until the schema is not validated for a given URL this function should keep on throwing error and once the schema is validated the data should be inserted in the DB.
    But its not happening as of now instead the ORA-31085 is thrown second time.
    Plz provide pointers to solve the issue.

    "mjs" <[email protected]> wrote in message
    news:g7kjk5$o6$[email protected]..
    > "mjs" <[email protected]> wrote in message
    > news:g7gl2g$i3d$[email protected]..
    >> "Zorrrro" <[email protected]> wrote
    in message
    >> news:g7gcjv$a6n$[email protected]..
    >>> I'm completely nuckered trying to find an answer
    for this...
    >>>
    >>> Does anyone know how to keep the same width an
    position of the submenus
    >>> of a
    >>> horizontal dropdown menu?
    >>> Thank you in advance.
    >>>
    >>> Cheers.
    >>
    >> Doesn't a simple style="width:200px" in the input
    tag work?
    >
    > I'll asume the answer is "yes", then. ;) You're welcome.
    I believe the OP is talking about a dropdown menu like this
    one
    http://www.tjkdesign.com/articles/keyboard_friendly_dropdown_menu/default.asp
    not about a "select menu".
    I could be wrong though...
    Thierry
    Articles and Tutorials:
    http://www.TJKDesign.com/go/?0
    http://developer.yahoo.com/
    helps you build applications and mashups

  • Can you use 2 sets of bluetooth headphones at the same time with the Ipad 4?

    Hi, I was wondering if anyone could tell me if I can use 2 sets of bluetooth headphones at the same time with the Ipad?
    It is so my children can watch a film or listen to music together.
    Thanks

    No

  • Can I record video and line in mixer at the same time with iPod touch?

    Can I record video and line in mixer audio at the same time, with the iPod touch?

    What is a "line in imxer audio" You can use an externeral mic plugged into the headphone jack to record auid for a video using the 4G iPod's camera.

  • I have an iPhone 5 on the Sprint Network.  My iMessaging seems to work when it wants to when sending a message to others on the Sprint Network.  I can send an iMessage to someone on Verizon during the same time and it works just fine?

    I have iPhone 5 on Sprint.  My husband is also on Sprint and my iMessage to him seems to work whenever it wants.  I can iMessage to friends who have Verizon at the exact same time I am trying to iMessage my husband and the iMessages will go to and from the Verizon friends just fine, but not to my husband.  With him its not even pretending to send our messages as iMessages.  The send bar isn't even blue to him.  To me this seems like an issue with the Sprint Network, but I wanted to see if anyone had had the same/simmilar issues and it ended up being the phone. 

    I can tell you that with Sprint their coverage area isn't as good as Verizon or AT&T.
    Are you sending these imessage while on wifi or cellular data?  Also your husband would need to be in a good coverage area.
    Usually when imessage is unavailable it will send it as a text.  Does your husband receive your imessage as a text?

  • From mac mail,  I can send but not receive mail. Also, on the same mac, I can run mail through Entourage and no issues with sending or receiving

    only found this problem with mac mail , when new hard drive waqs installed!!
    i CAN SEND from mac mail
    When I first set it up, i could receive mail but not send and now its the other way around
    I cannot receive mail.
    However, under Entourage mail, i have not problems with similar settings!!
    Can you help, this is wrecking my head!!

    What do you see if you invoke Mail's menu option Window > Connection Doctor?

  • How to keep the same URL with a redesigned website

    I have completely redesigned my muse website and want to replace the old one which is already live. How do I go about doing so and keeping the same URL?

    Hi
    You can upload the site to root which would replace the existing one.
    http://helpx.adobe.com/muse/topics/exporting-publishing.html
    Thanks,
    Sanjit

  • How to use the same BSA with more than an operating unit ?

    we have three operating units, sometimes a sales agreement is released from the three operating units, is there a way i can use the same sales agreemnet with the three operating units?

    We had the same issue recently.
    Users wanted same locator in the same org under different subinventories.
    We suggested 2 solutions
    1) Make the 1st locator segment=subinventory name (e.g. East.A.3.10, West.A.3.10)
    2) Add a character to the first locator (e.g. EA.3.10, WA.3.10)
    They picked up the 2nd option.
    Hope this helps
    Sandeep Gandhi
    Omkar Technologies Inc.
    Independent Techno-functional Consultant
    513-325-9026

  • How to use the Rc4DLL.dll with java (jre1.4 )

    I am not able to use Rc4DLL.dll with java, there are some characters (encrypted using Rc4DLL.dll) that java is not able to identify. So while decrypting in java using Rc4DLL I am not getting the desired output (as some character java tries to decrypt are not supported with java). Could some one give a solution of using Rc4DLL with java jre 1.4

    RC4 cipher is supported by 1.4.
    And surely you can turn a link to the 1.5.0 JCE Reference Guide into a link to the 1.4.2 Reference Guide? I did. Took me 5 seconds to check that. As opposed to wasting a day and a half in forums like you just did.

  • How to reach the fisical Layer with java

    Hello!
    I want to develop a gateway using java. I need to reach at least the data control link layer.
    which API would help me.
    Thanks a lot!

    Java doesn't go down that far for the simple reason it's not machine independent.
    I did some work on interrupt driven device I/O using a thin Linux module and the new real-time Java APIs (and a real-time version of Linux). Essentially as proof of concept.
    But I can't help feeling that if you're asking this question, you're really going to be out of your depth anyway.
    Sylvia.

  • How to validate the Xml File With Java

    Hi,
    Can pls tell me. I want to validate the XML File for the Some Mandartory TAG. if that if Tag null i want to generate error xml file with error and i want move another folder with java. pls help me as soon as possible

    Use a validating parser (any recent Xerces, for one) and switch on the validation feature. Very much vendor-specific, so look at the docs of your parser. Oh, you do have a schema for these documents, don't you?

  • HT201320 Unable to step my outlook account keep getting warning unable to verify account I can send and receive mail on my iMac using the outlook account HELP

    Unable to setup my ipad for my outlook account I keep getting the message unable to verify, although I can send and receive mail from my iMac using the same outlook account.

    Confirm you did this: https://support.google.com/mail/answer/1173270?hl=en
    You might also try removing all gmail passwords from your keychain in Keychain Access. Then connect again and enter the password code given by Google.

  • Can i use ichat between two separate macs on the same mobile me account?

    Can i use ichat over two separate macs on the same mobile me account?
    I have an imac at home and may be getting a macbook for work. Can i use my mobile me account to chat between the two macs or would i need a mobile me account per mac??

    Hi,
    No.
    You need two names that can login into AIM.
    In iChat you can use the Get an iChat Account which shows after you use the Plus Button in Accounts.
    This will give you a free @mac.com Name
    AIM Names are also free.
    9:31 PM Saturday; July 4, 2009
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"

  • How to share the same coherence cache in two EPN

    hi,all:
    I need to share the same coherence cache in two EPN. to put data into this coherence cache.
    only whe EPN can been deploy ok, the other EPN deploy will get below exception.
    Caused By: java.lang.IllegalStateException: Service "synergy-scheme-service" has been started by the factory with a different configuration descriptor
    at com.tangosol.net.DefaultConfigurableCacheFactory.validateBackingMapManager(DefaultConfigurableCacheFactory.java:1246)
    who can tell me why? or who can give me a example on how to share the same coherence cache in two EPN.
    thanks a lots

    Hi,
    This is because the system detects that you are using different configuration for the cache of the same name(and the domain name). If you want, we can discuss it, my mail is [email protected]
    Thanks
    Junger

  • Can't add mailboxes to gmail but when I try the same procedure with Bell mail I don't get an edit button so can't add any mailboxes.

    I have 2 email accounts Gmail and Bell mail. I can add mailboxes to gmail but when I try the same procedure with Bell mail I don't get an edit button so can't add any mailboxes.

    Mailboxes can be added only to IMAP accounts. Is Bell setup as IMPAP or POP?

Maybe you are looking for