Class: Capybara::Chrome::RDPSocket
- Inherits:
-
Object
- Object
- Capybara::Chrome::RDPSocket
- Defined in:
- lib/capybara/chrome/rdp_socket.rb
Constant Summary collapse
- READ_LEN =
4096
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ RDPSocket
constructor
A new instance of RDPSocket.
- #read ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(url) ⇒ RDPSocket
Returns a new instance of RDPSocket.
6 7 8 9 10 |
# File 'lib/capybara/chrome/rdp_socket.rb', line 6 def initialize(url) uri = URI.parse(url) @url = uri.to_s @io = TCPSocket.new(uri.host, uri.port) end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
4 5 6 |
# File 'lib/capybara/chrome/rdp_socket.rb', line 4 def io @io end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/capybara/chrome/rdp_socket.rb', line 4 def url @url end |
Instance Method Details
#read ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/capybara/chrome/rdp_socket.rb', line 16 def read buf = "" loop do buf << io.recv_nonblock(READ_LEN) end rescue IO::EAGAINWaitReadable if buf.size == 0 puts "buf is #{buf.size}" puts caller[0..10] end buf end |
#write(data) ⇒ Object
12 13 14 |
# File 'lib/capybara/chrome/rdp_socket.rb', line 12 def write(data) io.sendmsg data end |