Standards
Standards / Extensions |
C or C++ |
Dependencies |
z/OS® UNIX |
both |
|
Format
X/Open:
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/socket.h>
int setpeer(int socket, struct sockaddr *address, int length, char *name);
Berkeley sockets:
#define _OE_SOCKETS
#include <sys/socket.h>
int setpeer(int socket, struct sockaddr *address, int length, char *name);
General
description
The setpeer() function presets the peer address associated with
a socket.
Note: Neither AF_INET, AF_UNIX, nor AF_INET6 support
this function.
- Parameter
- Description
- socket
- The socket descriptor.
- address
- The address of the socket peer.
- length
- The length of the socket address.
- name
- The name of a field indicating the conditions of the peer request.
Special behavior for C++: To use this function
with C++, you must use the _XOPEN_SOURCE_EXTENDED 1 feature test
macro.
Returned value
setpeer() always returns -1.
- Error Code
- Description
- EINVAL
- The request is invalid or not supported.