res_close()--Close Socket and Reset _res Structure


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

 void res_close(void)

  Service Program Name: QSOSRV2

  Default Public Authority: *USE

  Threadsafe: Yes

The res_close() function is used to reset the _res structure to the beginning defaults and close a socket that is opened as a result of the RES_STAYOPEN flag.


Authorities:

No authorization is required.


Return Value

None.


Usage Notes

  1. If res_send() was previously called with RES_STAYOPEN set in the options field of the _res structure, res_close() closes the socket that was left open. res_close() does not attempt the close if there was no socket left open.

  2. res_close() sets the _res structure to default values.
    • The retrans field is set to 5.
    • The retry field is set to 4.
    • The options field has the RES_RECURSE, RES_DEFDNAMES, and RES_DNSSRCH bits set.
    • The nscount field is set to 1.
    • All other fields in the _res structure are cleared.
    • In a thread-enabled environment _res structure is shared among all threads within a process.

Related Information



API introduced: V3R1

[ Back to top | UNIX-Type APIs | APIs by category ]