ntohl, ntohs, etc

Discussion in 'Java' started by JohnP, Dec 28, 2004.

  1. JohnP

    JohnP Guest

    are there any classes in java.net or javax that provide the ntohx
    functionality.


    Thanks for your help


    john
     
    JohnP, Dec 28, 2004
    #1
    1. Advertising

  2. JohnP

    Chris Smith Guest

    JohnP <> wrote:
    > are there any classes in java.net or javax that provide the ntohx
    > functionality.


    No, because it is not needed. There is no way to observe the host byte
    order in Java, and all API functions that depend on byte ordering
    specify which they use (generally network byte order). When you write
    socket code, you'll typically write binary data using either a
    java.io.DataOutputStream or some view of java.nio.ByteBuffer, and these
    will give you the conversion you need.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Dec 28, 2004
    #2
    1. Advertising

  3. JohnP

    coltrane Guest

    thanks.
    out of curiosity, is this documented in the spec or anywhere else?
    thanks again for the help

    john
     
    coltrane, Dec 28, 2004
    #3
  4. JohnP

    coltrane Guest

    thanks.
    out of curiosity, is this documented in the spec or anywhere else?
    thanks again for the help

    john
     
    coltrane, Dec 28, 2004
    #4
  5. coltrane wrote:
    > thanks.
    > out of curiosity, is this documented in the spec or anywhere else?


    It is documented in the API documentation for all methods that read or
    write integer types, and also in the Java Virtual Machine Specification
    where it is relevant to the class file format. I don't think it's
    mentioned anywhere else in the JVMS or the JLS since it's not relevant
    to the language itself.
     
    Michael Borgwardt, Dec 28, 2004
    #5
  6. JohnP wrote:
    > are there any classes in java.net or javax that provide the ntohx
    > functionality.


    If you are communicating with a legacy application that produces /
    expects data in non-network format (norty), you may find
    java.nio.ByteBuffer useful.
     
    Thomas Schodt, Dec 28, 2004
    #6
    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. Robin Cull
    Replies:
    5
    Views:
    442
    Andrew Dalke
    Jul 31, 2003
  2. Daniel Joyce

    Python Audio (Alpy, Fastaudio, Etc Etc)

    Daniel Joyce, Sep 16, 2003, in forum: Python
    Replies:
    1
    Views:
    949
    Markus Wankus
    Sep 16, 2003
  3. Marco Herrn
    Replies:
    7
    Views:
    649
    Ng Pheng Siong
    Apr 9, 2004
  4. Kevin Walzer

    Re: PIL (etc etc etc) on OS X

    Kevin Walzer, Aug 1, 2008, in forum: Python
    Replies:
    4
    Views:
    451
    Fredrik Lundh
    Aug 13, 2008
  5. James Harris

    htons, htonl, ntohs, ntohl

    James Harris, Aug 23, 2013, in forum: C Programming
    Replies:
    32
    Views:
    740
    Jorgen Grahn
    Aug 31, 2013
Loading...

Share This Page