Chapter Contents

Previous

Next
takesocket_pid

takesocket_pid



Takes a Socket Descriptor from a Donor Process

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUES
CAUTION
PORTABILITY
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <sys/sockets.h>

int takesocket_pid(struct clientpid *clientpid, int s, pid_t pid);

struct clientpid * clientpid;  /* pointer to the clientpid structure  */
int s;                         /* socket identifier                   */
pid_t pid;                     /* process ID from getclientpid()      */


DESCRIPTION

The takesocket_pid function is used to acquire a specified socket from the process identified in the clientpid parameter.

takesocket_pid is similiar to the takesocket function. However, it uses the information in the clientpid structure.

The clientpid structure member domain must contain the same value as the one returned by the call to givesocket_pid. If the domain member is 0, then a default of AF_INET is used.

The socket identifier parameter, s, must contain the socket identifier, either descriptor or token, that was returned by a call to the givesocket_pid function. This socket identifier must be used in any subsequent TCP/IP calls.


RETURN VALUES

If takesocket_pid succeeds, it returns the socket identifier, that is, either a socket descriptor or a token. Otherwise, it returns a -1 , and sets errno to indicate the error.

Note:    The clientpid structure upon return will contain the following values:
domain the domain of the socket to be taken, default = AF_INET.
pid the process ID number of client process.
sid socket identifier.
All other fields in the clientpid structure are set to binary zeros (0x00).  [cautionend]


CAUTION

The takesocket_pid function is available only for integrated sockets on OS/390 Version 1 Release 3 or later.


PORTABILITY

takesocket_pid is not portable to UNIX operating systems. On UNIX operating systems, sockets are typically transferred from parent to child processes as a side effect of the fork system call.


RELATED FUNCTIONS

getclientid, getclientpid, givesocket, givesocket_pid, takesocket


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.