Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ntohl, ntohs, etc

Reply
Thread Tools

ntohl, ntohs, etc

 
 
JohnP
Guest
Posts: n/a
 
      12-28-2004
are there any classes in java.net or javax that provide the ntohx
functionality.


Thanks for your help


john


 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      12-28-2004
JohnP <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
coltrane
Guest
Posts: n/a
 
      12-28-2004
thanks.
out of curiosity, is this documented in the spec or anywhere else?
thanks again for the help

john

 
Reply With Quote
 
coltrane
Guest
Posts: n/a
 
      12-28-2004
thanks.
out of curiosity, is this documented in the spec or anywhere else?
thanks again for the help

john

 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      12-28-2004
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.
 
Reply With Quote
 
Thomas Schodt
Guest
Posts: n/a
 
      12-28-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PIL (etc etc etc) on OS X Kevin Walzer Python 4 08-13-2008 08:27 AM
there are too many warnings (you are about to....etc etc forever) after installing Firefox trevor_smithson@yahoo.com Firefox 2 10-13-2005 07:35 PM
user authentication via /etc/passwd|/etc/shadow Marco Herrn Python 7 04-09-2004 12:12 PM
Python Audio (Alpy, Fastaudio, Etc Etc) Daniel Joyce Python 1 09-16-2003 08:39 PM
Is there a standard module library function to access /etc/passwd or /etc/group Robin Cull Python 5 07-31-2003 09:35 PM



Advertisments