BYTEORDER(3) BSD Library Functions Manual BYTEORDER(3)NAME
htonl, htons, ntohl, ntohs -- convert values between host and network byte order
LIBRARY
Standard C Library (libc, -lc)
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
These routines convert 16 and 32 bit quantities between network byte order and host byte order. (Network byte order is big endian, or most
significant byte first.) On machines which have a byte order which is the same as the network order, routines are defined as null macros.
These routines are most often used in conjunction with Internet addresses and ports as returned by gethostbyname(3) and getservent(3).
SEE ALSO gethostbyname(3), getservent(3)STANDARDS
The byteorder functions are expected to conform with IEEE Std POSIX.1-200x (``POSIX.1'').
HISTORY
The byteorder functions appeared in 4.2BSD.
BUGS
On the VAX bytes are handled backwards from most everyone else in the world. This is not expected to be fixed in the near future.
BSD June 4, 1993 BSD
Check Out this Related Man Page
BYTEORDER(3) BSD Library Functions Manual BYTEORDER(3)NAME
htonl, htons, ntohl, ntohs -- convert values between host and network byte order
LIBRARY
Standard C Library (libc, -lc)
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
These routines convert 16 and 32 bit quantities between network byte order and host byte order. (Network byte order is big endian, or most
significant byte first.) On machines which have a byte order which is the same as the network order, routines are defined as null macros.
These routines are most often used in conjunction with Internet addresses and ports as returned by gethostbyname(3) and getservent(3).
SEE ALSO gethostbyname(3), getservent(3)STANDARDS
The byteorder functions are expected to conform with IEEE Std POSIX.1-200x (``POSIX.1'').
HISTORY
The byteorder functions appeared in 4.2BSD.
BUGS
On the VAX bytes are handled backwards from most everyone else in the world. This is not expected to be fixed in the near future.
BSD June 4, 1993 BSD
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)