Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

htonl(3) [centos man page]

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. CONFORMING TO
POSIX.1-2001. Some systems require the inclusion of <netinet/in.h> instead of <arpa/inet.h>. SEE ALSO
endian(3), gethostbyname(3), getservent(3) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2009-01-15 BYTEORDER(3)

Check Out this Related Man Page

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. CONFORMING TO
POSIX.1-2001. Some systems require the inclusion of <netinet/in.h> instead of <arpa/inet.h>. SEE ALSO
endian(3), gethostbyname(3), getservent(3) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2009-01-15 BYTEORDER(3)
Man Page

13 More Discussions You Might Find Interesting

1. Programming

Not able to compile C program on z/OS (USS)

Hi, I having an issue while compiling a C program in USS (z/OS) machine. I was able to create objest files (.o) from source (.c) files but when I try to create a binary file from the object files I am getting the below error. $ cc util.o sock.o app.o -lnsl -o ptf FSUM3067 The archive... (7 Replies)
Discussion started by: madhu84
7 Replies

2. Programming

Ubuntu 10.04 + Multicast Receiver c++

Hello all, I have created a UDP multicast transmitter and receiver, first using windows. But now I need the receiver to run on Ubuntu 10.04. The code is the following: /************************** Receiver *************************/ // Module Name: Receiver.c // // Description: // ... (0 Replies)
Discussion started by: tiny05
0 Replies

3. Programming

Help needed in my client/server app - Delay in displaying messages from clients.

Ok so this is what I have. I have separate client and server codes. I initially had the server listening and accepting connections from ONE port, and it was working great. Now, what I want to do is, enable the server to listen and accept connections on TWO OR MORE ports , thus, effectively... (2 Replies)
Discussion started by: CrazedMonk
2 Replies

4. UNIX Desktop Questions & Answers

Listening on localhost - cannot connect to host using port 3010

Hi Guys, my issue is - I have people connecting to my hosts from the outside world (for POC testing). There application listens on a port 3010 which is bound to the localhost. Using netstat -an | grep LISTEN it is the only port that is bound - ie: ftp, ssh etc listen on all interfaces. I need... (1 Reply)
Discussion started by: brian112
1 Replies

5. Programming

Using Different port for Daytime Service

Hi all, is it possible to use a different port number for daytime service. By default the port number of daytime service is 13, so what if I want to get the time from a different port number e.g say 9000 (or any other port). I guess this would remain the same on the server side !... (2 Replies)
Discussion started by: manisum
2 Replies

6. Programming

Child threads communicating with main thread via pipes

I have a simple client/server program I am using for learning purposes. I have it setup so that after server is setup and listening it than goes into a loop where it accepts incoming client connections. After each connection, the client socket is than passed to a thread routine where it can be... (3 Replies)
Discussion started by: Majortom71
3 Replies

7. Programming

Clients - Server ( UDP )

Hello, I have a question: I want to create a n client to one server connection. This is the client-server algorithm. Enybody help to make the changes? (0 Replies)
Discussion started by: MaHmur
0 Replies

8. Programming

Getting error address already in use in socket programming

Hi , I am getting error in bind function of "Address already in use" even also i have used the setsockopt function in that case . Please help int ret = 0; int listenSock = 0; struct sockaddr_in myAddr; struct sockaddr_in ... (1 Reply)
Discussion started by: vipin auja
1 Replies

9. UNIX for Advanced & Expert Users

USB-Ethernet/Ethernet-USB

Hi, I have posted several times regarding my application. In a nutshell, I have a server application that logs attached instrument data over USB and Ethernet. My restriction here is having two wires or more to plug all instrumentation in - at least one for USB and at least one for ethernet. ... (16 Replies)
Discussion started by: fedora18
16 Replies

10. Programming

Event driven programming / epoll / typedef union / session data array

Sorry for the “word salad” subject, but I wanted to cast a wide net for help. I've created an IP (Internet Protocol) server which serves HTTP, SMTP, and FTP requests. As you probably know, they all require creating a socket, listening on it, accepting connections, and then having a short... (3 Replies)
Discussion started by: John S.
3 Replies

11. Programming

Warning: pointer type mismatch

Hi all, I'm new programming in C, so I had the next message in my code: Dual.c:88:20: warning: pointer type mismatch in conditional expression : &clientSa.sin6.sin6.sin6_addr, Any help would be great #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include... (1 Reply)
Discussion started by: godna
1 Replies

12. Programming

Socket dual client/server Linux

I'm trying to make a "dual/server client" (ipv4,ipv6) with sockets in linux but i don't know how to join both codes. I have a dual client ipv4 and ipv6, but i have problems with the server if you notice the only difference between them it's the AF_INET (pf_inet ipv4, and if_inet6 ipv6) and the port... (3 Replies)
Discussion started by: godna
3 Replies

13. UNIX for Advanced & Expert Users

Bind() with SO_BINDTODEVICE returns errno 125

I am setting the socket option SO_BINDTODEVICE for eth0 to be able to route the packets only through that interface. However, bind() fails with "Port already in use" error with this option when the server is restarted despite having the socket option SO_REUSEADDR. Here is my code snippet: ... (0 Replies)
Discussion started by: deepti0719
0 Replies