byteorder(3SOCKET) Sockets Library Functions byteorder(3SOCKET)NAME
byteorder, htonl, htons, ntohl, ntohs - convert values between host and network byte order
SYNOPSIS
cc [ flag... ] file... -lsocket -lnsl [ library... ]
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.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
These routines convert 16-bit and 32-bit quantities between network byte order and host byte order. On some architectures these routines
are defined as NULL macros in the include file <netinet/in.h>. On other architectures, the routines are functional when the host byte order
is different from network byte order.
The routines are most often used in conjunction with Internet addresses and ports as returned by gethostent() and getservent(). See geth-
ostbyname(3NSL) and getservbyname(3SOCKET).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO gethostbyname(3NSL), getservbyname(3SOCKET), inet.h(3HEAD), attributes(5)SunOS 5.10 19 Feb 2004 byteorder(3SOCKET)
Check Out this Related Man Page
byteorder(3SOCKET) Sockets Library Functions byteorder(3SOCKET)NAME
byteorder, htonl, htonll, htons, ntohl, ntohll, ntohs - convert values between host and network byte order
SYNOPSIS
cc [ flag... ] file... -lsocket -lnsl [ library... ]
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
uint32_t htonl(uint32_t hostlong);
uint64_t htonll(uint64_t hostlonglong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint64_t ntonll(uint64_t hostlonglong);
uint16_t ntohs(uint16_t netshort);
DESCRIPTION
These functions convert 16-bit, 32-bit, and 64-bit quantities between network byte order and host byte order. On some architectures these
routines are defined as NULL macros in the include file <netinet/in.h>. On other architectures, the routines are functional when the host
byte order is different from network byte order.
These functions are most often used in conjunction with Internet addresses and ports as returned by gethostent() and getservent(). See
gethostbyname(3NSL) and getservbyname(3SOCKET).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO gethostbyname(3NSL), getservbyname(3SOCKET), inet.h(3HEAD), attributes(5)SunOS 5.11 10 Sep 2008 byteorder(3SOCKET)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)