Skip to content

[#598] New v70003/socket_opts-gtmf135169 Verify additional options for SOCKET devices

Release Note says:

The OPEN and USE commands for SOCKET devices support assigning characteristics maintained with the POSIX setsockopt() service using the OPTIONS deviceparameter for the newly created socket or the current socket.

OPTIONS=expr Applies to: SOC

The argument (expr) is a string which contains a comma separated list of setsockopt options. If the option takes a value, it is given after an equal sign (=) following the option. The supported options are:

  • KEEPALIVE - a positive value enables SO_KEEPALIVE. A zero value disables SO_KEEPALIVE.
  • KEEPIDLE - sets the TCP_KEEPIDLE socket value.
  • KEEPCNT - sets the TCP_KEEPCNT socket value.
  • KEEPINTVL - sets the TCP_KEEPINTVL socket value.
  • SNDBUF - sets the size of the socket's network send buffer (SO_SNDBUF) in bytes.

Examples:

USE dev:OPTIONS="KEEPALIVE=1,KEEPIDLE=50" This enables SO_KEEPALIVE and set TCP_KEEPIDLE to 50 seconds.

USE dev:OPTIONS="KEEPALIVE=0" This disables SO_KEEPALIVE.

Note For more information on the use of these options, please review _the man page for setsockopt . On Linux, "man 7 socket" and _ "man 7 tcp" provide additional information.

The $ZSOCKET() function supports an "OPTIONS" keyword which takes an index argument and returns a string of the OPTIONS previously specified for the selected socket. The string may not exactly match the string originally specified but has the same meanings.

The new keywords "KEEPALIVE", "KEEPCNT", "KEEPIDLE", "KEEPINTVL", and "SNDBUF" return the individual items. If the system's current value for the item doesn't match the value previously specified with the OPTIONS device parameter, both values are returned separated by a semicolon (";"): "uservalue;systemvalue".

The "ZIBFSIZE" keyword may return the system value for SO_RCVBUF in addition to the value from the ZIBFSIZE device parameter. Note that the operating system may modify the values specified for SO_RCVBUF and SO_SNDBUF so the returned values for those options obtained with POSIX getsockopt() service may be different than those specified using setsockopt(). (GTM-F135169)

See http://tinco.pair.com/bhaskar/gtm/doc/articles/GTM_V7.0-003_Release_Notes.html#GTM-F135169

Edited by Erno Zalka

Merge request reports