Telnet client, can't get end of message

[code]#!/usr/bin/ruby
require “socket”
require “timeout”

socket=TCPSocket.new(‘192.168.56.101’,23)
puts “socket=#{socket}”

if !socket.closed?
mes=socket.gets
end

socket.close

puts mes

[code]

Script can’t finish getting message, how can i get сertain quantity of
bytes without waiting the message end ?

born in USSR wrote:

[code]#!/usr/bin/ruby
require “socket”
require “timeout”

socket=TCPSocket.new(‘192.168.56.101’,23)
puts “socket=#{socket}”

if !socket.closed?
mes=socket.gets
end

socket.close

puts mes

[code]

Script can’t finish getting message, how can i get сertain quantity of
bytes without waiting the message end ?

read(10), recv(82)

,
,
,
,
,
,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs