BYTEORDER(3N) UNIX Programmer's Manual BYTEORDER(3N) NNAAMMEE htonl, htons, ntohl, ntohs - convert values between host and network byte order SSYYNNOOPPSSIISS ##iinncclluuddee <<ssyyss//ttyyppeess..hh>> ##iinncclluuddee <<nneettiinneett//iinn..hh>> nneettlloonngg == hhttoonnll((hhoossttlloonngg));; uu__lloonngg nneettlloonngg,, hhoossttlloonngg;; nneettsshhoorrtt == hhttoonnss((hhoossttsshhoorrtt));; uu__sshhoorrtt nneettsshhoorrtt,, hhoossttsshhoorrtt;; hhoossttlloonngg == nnttoohhll((nneettlloonngg));; uu__lloonngg hhoossttlloonngg,, nneettlloonngg;; hhoossttsshhoorrtt == nnttoohhss((nneettsshhoorrtt));; uu__sshhoorrtt hhoossttsshhoorrtt,, nneettsshhoorrtt;; DDEESSCCRRIIPPTTIIOONN These routines convert 16 and 32 bit quantities between net- work byte order and host byte order. On machines such as the SUN these routines are defined as null macros in the include file <_n_e_t_i_n_e_t/_i_n._h>. These routines are most often used in conjunction with Internet addresses and ports as returned by _g_e_t_h_o_s_t_b_y_n_a_m_e(3N) and _g_e_t_s_e_r_v_e_n_t(3N). SSEEEE AALLSSOO gethostbyname(3N), getservent(3N) BBUUGGSS The VAX handles bytes backwards from most everyone else in the world. This is not expected to be fixed in the near future. Printed 7/9/88 May 15, 1986 1