H
hemant
I have following code, the problem is, when i start a connection to
the socket through telnet, the data send by the server i get as
usual, but when i try to do the same through ruby code, the data send
by the server won't come to the client..until the server is shutdown.
def receive_data data
data = data.chomp.strip
if is_symbol?(data)
add_symbol(data)
local_connection = self
start_send_thread(local_connection)
end
end
def start_send_thread(local_connection)
unless @send_started
p "Trying to send the data"
@send_started = true
@local_thread = Thread.new do
loop do
broadcast_data(local_connection)
sleep(0.1)
p "I am running"
end
end
end
end
def broadcast_data(local_connection)
for x in @local_symbols
local_connection.send_data "#{x}"+rand(10).to_s
end
end
def unbind
p "Client closed the connection"
Thread.kill(@local_thread)
end
the socket through telnet, the data send by the server i get as
usual, but when i try to do the same through ruby code, the data send
by the server won't come to the client..until the server is shutdown.
def receive_data data
data = data.chomp.strip
if is_symbol?(data)
add_symbol(data)
local_connection = self
start_send_thread(local_connection)
end
end
def start_send_thread(local_connection)
unless @send_started
p "Trying to send the data"
@send_started = true
@local_thread = Thread.new do
loop do
broadcast_data(local_connection)
sleep(0.1)
p "I am running"
end
end
end
end
def broadcast_data(local_connection)
for x in @local_symbols
local_connection.send_data "#{x}"+rand(10).to_s
end
end
def unbind
p "Client closed the connection"
Thread.kill(@local_thread)
end