z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


takesocket()

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The takesocket() call acquires a socket from another program. Typically, the other program passes its client ID and socket descriptor to your program through your program startup parameter list.

#include <manifest.h>
#include <bsdtypes.h>
#include <socket.h>
 
int takesocket(struct clientid *clientid, int hisdesc)
Parameter
Description
clientid
Points to the clientid of the application from which you are taking a socket.
hisdesc
Describes the socket to be taken.

The takesocket() call acquires a socket from another program. Typically, the other program passes its client ID and socket descriptor to your program through your program startup parameter list.

Return values

A nonnegative socket descriptor indicates success. The value -1 indicates an error. Errno identifies a specific error.
Errno
Description
EACCES
The other application did not give the socket to your application.
EBADF
The hisdesc parameter does not specify a valid socket descriptor owned by the other application. The socket has already been taken.
EFAULT
Using the clientid parameter as specified would result in an attempt to access storage outside the caller address space.
EINVAL
The clientid parameter does not specify a valid client identifier.
EMFILE
The socket descriptor table is already full.
ENOBUFS
The operation cannot be performed because of a shortage of control blocks (SCB or SKCB) in the TCP/IP address space.
EPFNOSUPPORT
The domain field of the clientid parameter is not AF_INET.

Related calls

getclientid(), givesocket()

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014