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


setibmsockopt()

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

Like setsockopt() call, the setibmsockopt() call sets the options associated with a socket in the AF_INET domain. This call is for options specific to the IBM® implementation of sockets.

#include <manifest.h>
#include <socket.h>
 
int setibmsockopt(int s, int level, int optname, char *optval, int optlen)
Parameter
Description
s
Socket descriptor.
level
Level for which the option is being set. Only SOL_SOCKET is supported.
optname
The name of a specified socket option.
optval
Points to option data.
optlen
The length of the option data.

SO_IGNOREINCOMINGPUSH is another option to consider. This option is meaningful only for stream sockets. This option is effective only for connections established through an offload box. If optval points to 1, the option is set. If optval points to 0, the option is off.

The SO_IGNOREINCOMINGPUSH option causes a receive call to return when one of the following situations occurs:
  • The requested length is reached.
  • The internal TCP/IP length is reached.
  • The peer application closes the connection.
The amount of data returned for each call is maximized and the amount of CPU time consumed by your program and TCP/IP is reduced.

This option is not appropriate to your operation if your program depends on receiving data before the connection is closed. For example, this option is appropriate for an FTP data connection, but not for a Telnet connection.

Return values

The value 0 indicates success; the value -1 indicates an error. Errno identifies the specific error.
Errno
Description
EBADF
The s parameter is not a valid socket descriptor.
EFAULT
Using optval and optlen parameters would result in an attempt to access storage outside the caller address space.
ENOPROTOOPT
The optname parameter is unrecognized, or the level parameter is not SOL_SOCKET.

Example

#include <manifest.h>
#include <socket.h>
#include <tcperror.h>
 
{ struct ibm_bulkmode_struct bulkstr;
  int optlen, rc;
 
  optlen = sizeof(bulkstr);
  rc = getibmsockopt(s, SOL_SOCKET, , (char *), &bulkstr, &optlen);
  if (rc < 0) {
      tcperror("on getibmsockopt()");
      exit(1);
  }
  fprintf(stream,"%d byte buffer available for outbound queue.\n",
          bulkstr.b_max_send_queue_size_avail);
 
  bulkstr.b_max_send_queue_size=bulkstr.b_max_send_queue_size_avail;
  bulkstr.b_onoff = 1;
  bulkstr.b_teststor = 0;
  bulkstr.b_move_data = 1;
  bulkstr.b_max_receive_queue_size = 65536;
  rc = setibmsockopt(s, SOL_SOCKET, , (char *), &bulkstr, optlen);
  if (rc < 0) {
      tcperror("on setibmsockopt()");
      exit(1);
  }
}
 

Related calls

getibmsockopt(), getsockopt(), ibmsflush(), setsockopt()

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014