Class: CZTop::Socket::CLIENT

Inherits:
CZTop::Socket show all
Defined in:
lib/cztop/socket/types.rb

Overview

Client socket for the ZeroMQ Client-Server Pattern.

Constant Summary

Constants inherited from CZTop::Socket

TypeNames

Constants included from CZTop::SendReceiveMethods

CZTop::SendReceiveMethods::JIFFY

Instance Attribute Summary

Attributes inherited from CZTop::Socket

#last_tcp_port

Attributes included from HasFFIDelegate

#ffi_delegate

Instance Method Summary collapse

Methods inherited from CZTop::Socket

#CURVE_client!, #CURVE_server!, #bind, #close, #connect, #disconnect, #inspect, #last_endpoint, new_by_type, #unbind

Methods included from HasFFIDelegate::ClassMethods

#ffi_delegate, #from_ffi_delegate

Methods included from PolymorphicZsockMethods

#set_unbounded, #signal, #wait

Methods included from CZTop::SendReceiveMethods

#<<, #read_timeout, #receive, #wait_readable, #write_timeout

Methods included from ZsockOptions

#fd, #options, #readable?, #to_io, #writable?

Methods included from HasFFIDelegate

#attach_ffi_delegate, #from_ffi_delegate, raise_zmq_err, #to_ptr

Constructor Details

#initialize(endpoints = nil) ⇒ CLIENT

Returns a new instance of CLIENT.

Parameters:

  • endpoints (String) (defaults to: nil)

    endpoints to connect to



73
74
75
76
77
# File 'lib/cztop/socket/types.rb', line 73

def initialize(endpoints = nil)
  super

  attach_ffi_delegate(Zsock.new_client(endpoints))
end

Instance Method Details

#wait_writableObject

Raises:

  • (SocketError)

    if no peer is connected



81
82
83
84
85
86
87
# File 'lib/cztop/socket/types.rb', line 81

def wait_writable(...)
  if !writable?
    fail SocketError, "no peer connected"
  end

  super
end