[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

_getshort Subroutine


Retrieves short byte quantities.


Standard C Library (libc.a)


#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

unsigned short getshort ( MessagePtr)
u_char *MessagePtr;


The _getshort subroutine gets quantities from the byte stream or arbitrary byte boundaries.

The _getshort subroutine is one of a set of subroutines that form the resolver, a set of functions that resolve domain names. Global information used by the resolver subroutines is kept in the _res data structure. The /usr/include/resolv.h file contains the _res structure definition.


MessagePtr Specifies a pointer into the byte stream.

Return Values

The _getshort subroutine returns an unsigned short (16-bit) value.

Implementation Specifics

The _getshort subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the _getshort subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.


                          Defines name server and domain names.

Related Information

The dn_comp subroutine, dn_expand subroutine, _getlong subroutine, putlong subroutine, putshort subroutine, res_init subroutine, res_mkquery subroutine, res_send subroutine.

Sockets Overview, and Understanding Domain Name Resolution in AIX 5L Version 5.1 Communications Programming Concepts.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]