Class: Pixelflut::Client::Socket
- Inherits:
-
Socket
- Object
- Socket
- Pixelflut::Client::Socket
- Defined in:
- lib/pixelflut/client/socket.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(address, data) ⇒ Socket
constructor
A new instance of Socket.
Constructor Details
#initialize(address, data) ⇒ Socket
Returns a new instance of Socket.
10 11 12 13 14 15 16 17 |
# File 'lib/pixelflut/client/socket.rb', line 10 def initialize(address, data) super(address.ipv6? ? :INET6 : :INET, :STREAM) configure @addr = ::Socket.pack_sockaddr_in(address.ip_port, address.ip_address) @data = data @size = data.bytesize @state = :not_connected end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
8 9 10 |
# File 'lib/pixelflut/client/socket.rb', line 8 def state @state end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pixelflut/client/socket.rb', line 19 def call case @state when :not_connected do_connect when :wait_connect do_wait_for_connect when :write do_write else close @state = :closed end end |