Class: XS::Socket

Inherits:
Object
  • Object
show all
Includes:
CommonSocketBehavior, IdentitySupport
Defined in:
lib/ffi-rxs/socket.rb

Overview

module IdentitySupport

Instance Attribute Summary

Attributes included from CommonSocketBehavior

#name, #socket

Instance Method Summary (collapse)

Methods included from IdentitySupport

#identity, #identity=

Methods included from CommonSocketBehavior

#bind, #close, #connect, create, #initialize, #more_parts?, #recv_multipart, #recv_string, #recv_strings, #recvmsg, #recvmsgs, #send_and_close, #send_string, #send_strings, #sendmsg, #sendmsgs, #setsockopt, #shutdown

Instance Method Details

- (Object) getsockopt(name, array)

Get the options set on this socket.

With a -1 return code, the user must check XS.errno to determine the cause.

Examples:

Retrieve send high water mark

array = []
rc = socket.getsockopt(XS::SNDHWM, array)
sndhwm = array.first if XS::Util.resultcode_ok?(rc)


657
658
659
660
661
662
663
664
665
666
# File 'lib/ffi-rxs/socket.rb', line 657

def getsockopt name, array
  rc = __getsockopt__ name, array

  if Util.resultcode_ok?(rc) && (RCVMORE == name)
    # convert to boolean
    array[0] = 1 == array[0]
  end

  rc
end