Telnet client, can't get end of message

L

Luckystr Luckystr

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 ?
 
7

7stud --

born said:
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 ?[/QUOTE]

read(10), recv(82)

,,,
,,
,
,
,
,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,460
Latest member
eibafima

Latest Threads

Top