Method: Usbmux::SafeStreamSocket#send

Defined in:
lib/usbmux/usbmux.rb

#send(message) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/usbmux/usbmux.rb', line 17

def send(message)
  total_sent = 0
  while total_sent < message.length
    sent = @sock.send(message[total_sent..-1], 0)
    if sent == 0
      raise MuxError.new('Socket connection broken')
    end
    total_sent += sent
  end
end