TCHAR in c++ to string in java

Discussion in 'Java' started by dwurity@yahoo.com, Dec 14, 2004.

  1. Guest

    Hi-
    I am developing file transfer application, the host is in c++ and the
    client is in java. In c++ I am using win32_find_data to get all the
    files list and i am sending it to the client through the stream.

    The client will reads all the specified information, but i am getting
    some blocks in the middle, I hope the problem will be at the reading
    side. The host will sends the data in form of win32_find_data format,
    and here i am reading the information, so i want how to process the
    fileName which is the field of the structure win32_find_data, at the
    client side (java side), should i use the charsetdecoder to convert the
    type TCHAR(fileName) data to string at java???
    Thanks in advance,
    dwurity
    , Dec 14, 2004
    #1
    1. Advertising

  2. wrote:
    > The client will reads all the specified information, but i am getting
    > some blocks in the middle, I hope the problem will be at the reading
    > side. The host will sends the data in form of win32_find_data format,
    > and here i am reading the information, so i want how to process the
    > fileName which is the field of the structure win32_find_data, at the
    > client side (java side), should i use the charsetdecoder to convert the
    > type TCHAR(fileName) data to string at java???


    No, you should define a portable communications protocol. C structs are
    not portable. When the protocol is clearly defined (that includes
    specifying the charset of Strings) then implementing it on the Java side
    will be straightforward.

    As it is, your host is fundamentally broken.
    Michael Borgwardt, Dec 14, 2004
    #2
    1. Advertising

  3. Bobby Guest

    No, i verified the host with another client which was writtened in c++
    and its working great with out any problems, the problem occured only
    with the java client!

    what is the problem???

    Thanks,
    dwurity
    Bobby, Dec 14, 2004
    #3
  4. Bobby Guest

    Hi-

    No, my host is working very well when I use the client which was done
    in c++, but it was the problem with the client written in java, what
    could be wrong???

    Thanks,
    dwurity
    Bobby, Dec 14, 2004
    #4
  5. Bobby Guest

    Hi-

    No, my host is working very well when I use the client which was done
    in c++, but it was the problem with the client written in java, what
    could be wrong???

    Thanks,
    dwurity
    Bobby, Dec 14, 2004
    #5
  6. Bobby Guest

    Hi-

    No, my host is working very well when I use the client which was done
    in c++, but it was the problem with the client written in java, what
    could be wrong???

    Thanks,
    dwurity


    Michael Borgwardt wrote:
    > wrote:
    > > The client will reads all the specified information, but i am

    getting
    > > some blocks in the middle, I hope the problem will be at the

    reading
    > > side. The host will sends the data in form of win32_find_data

    format,
    > > and here i am reading the information, so i want how to process the
    > > fileName which is the field of the structure win32_find_data, at

    the
    > > client side (java side), should i use the charsetdecoder to convert

    the
    > > type TCHAR(fileName) data to string at java???

    >
    > No, you should define a portable communications protocol. C structs

    are
    > not portable. When the protocol is clearly defined (that includes
    > specifying the charset of Strings) then implementing it on the Java

    side
    > will be straightforward.
    >
    > As it is, your host is fundamentally broken.
    Bobby, Dec 14, 2004
    #6
  7. Bobby wrote:

    > No, i verified the host with another client which was writtened in c++
    > and its working great with out any problems,


    That does not, in any way, constitute a "verification".

    > the problem occured only
    > with the java client!
    >
    > what is the problem???


    The problem is still that you do NOT have a clearly defined, portable
    communication protocol. Using C structs is an amateurish mistake, because
    they differ between compilers and architectures. Your C++ client may
    not work anymore when compiled with a different compiler or on a different
    machine.

    Define *exactly* what the host sends over the network, byte by byte, what
    fields of what length and with what content (including endianness and
    character encoding). Then implement that in Java.

    And stop those multiple reposts!
    Michael Borgwardt, Dec 14, 2004
    #7
  8. MaSTeR Guest

    "Michael Borgwardt" <> wrote in message
    news:...
    > Bobby wrote:
    >
    > And stop those multiple reposts!


    Maybe is posting with though his host ;)
    MaSTeR, Dec 14, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bobby
    Replies:
    0
    Views:
    392
    Bobby
    Dec 14, 2004
  2. ree
    Replies:
    7
    Views:
    3,760
  3. sorty
    Replies:
    4
    Views:
    20,708
    Rolf Magnus
    Nov 25, 2003
  4. Replies:
    4
    Views:
    5,213
    Muruganandam
    Feb 2, 2005
  5. Replies:
    14
    Views:
    4,378
    Phlip
    Aug 3, 2006
Loading...

Share This Page