04-18-2008
Hi,
You will have to re-order (use of htonl) them in both side: the sender and the receiver
On most RISC processor they're already in net-byte order but you should always use htonl/s to avoid byte ordering problem especially when dealing with different plateform IMHO
10 More Discussions You Might Find Interesting
1. Programming
I need port Win32 console application, which was developed with MS Visual Studio 6.0 (without MFC using) into Linux. What is the best way to port project? Are there any standard tools or decisions?
Thank you in advance,
Sergey (0 Replies)
Discussion started by: Sergeyy
0 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
i wanted to port some HP-UX code to linux. can anybody point to some documents or resources that would help me in doing the porting..
thanks in advance
Arun Prakash (0 Replies)
Discussion started by: arunprakash
0 Replies
3. Programming
Gents,
i'm a senior applications developer and need to port a Linux server application ( no additional / special libraries or unique header files ) to a HPUX enviroment.
Any chance to compile it on the Linux using flags to create an HPUX binary with gcc? (8 Replies)
Discussion started by: anak0nda
8 Replies
4. Linux
Hello All,
I have a code of DHCP which is implemented on Linux. During porting this code from Linux to VxWorks, I come up with following errors:-
jects\freedom\ap\udhcp\socket.c
C:\projects\freedom\ap\udhcp\socket.c: In function `read_interface':
C:\projects\freedom\ap\udhcp\socket.c:79:... (1 Reply)
Discussion started by: Sunny Shivam
1 Replies
5. Programming
I am new to Linux programming and my work involves changing an abstraction layer which made Nucleus calls, to Linux calls.
In Case of Events Nucleus has calls like
NU_Set_Events()
NU_Retrieve_Events()
Can I use the POSIX thread conditional variables for Linux?
Can I use the System V calls... (1 Reply)
Discussion started by: taklubaba
1 Replies
6. Filesystems, Disks and Memory
Hi,
I was trying to port efs_mount(OSE system call) to a LInux.The efs_mount function is used to mount a volume on the indicated device dev.Upon successful completion of this OSE sytem call a volume manager (VM) will be available through which files on this volume are accessed. The Syntax for... (4 Replies)
Discussion started by: roshantraj30
4 Replies
7. Solaris
Hi all,
Has anyone experience with proting a Linux driver (C-code) to Solaris 10?
I have a Sunix SATA card with a inicio1622 chipset, but no driver available. From the website of inicio I downloaded the drivercode for Linux 2.4.
Having done some investigation I found a Solaris driver... (4 Replies)
Discussion started by: longwave
4 Replies
8. Shell Programming and Scripting
Can any one please help the use of "cu command in Solaris" and as well as in Linux :confused: (1 Reply)
Discussion started by: sabee.prakash
1 Replies
9. Programming
I am challenged with porting an old application from Solaris to Red Hat. The application uses Rogue Wave and I am searching for a Red Hat implementation. Your help is appreciated! (2 Replies)
Discussion started by: FunkyWinkerbean
2 Replies
10. Shell Programming and Scripting
I have a script which has commands that are located in different paths on my Linux o/s than on Solaris. For example, to make uname work, I need to do it this way in Solaris:
my $host= `/usr/bin/uname -n` But in Linux it is:
my $host = `/bin/uname -n`I have this issue with at least 5... (8 Replies)
Discussion started by: newbie2010
8 Replies
LEARN ABOUT MINIX
byteorder
BYTEORDER(3) Linux Programmer's Manual BYTEORDER(3)
NAME
htonl, htons, ntohl, ntohs - convert values between host and network byte order
SYNOPSIS
#include <arpa/inet.h>
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
DESCRIPTION
The htonl() function converts the unsigned integer hostlong from host byte order to network byte order.
The htons() function converts the unsigned short integer hostshort from host byte order to network byte order.
The ntohl() function converts the unsigned integer netlong from network byte order to host byte order.
The ntohs() function converts the unsigned short integer netshort from network byte order to host byte order.
On the i386 the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Signifi-
cant Byte first.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+-----------------------------------+---------------+---------+
|Interface | Attribute | Value |
+-----------------------------------+---------------+---------+
|htonl(), htons(), ntohl(), ntohs() | Thread safety | MT-Safe |
+-----------------------------------+---------------+---------+
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
Some systems require the inclusion of <netinet/in.h> instead of <arpa/inet.h>.
SEE ALSO
bswap(3), endian(3), gethostbyname(3), getservent(3)
COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU 2017-09-15 BYTEORDER(3)