Stupid Problem

I’m a total newb as you’ll find out. But regardless, i have a question.
I run the code below:

It locks up (doesn’t do anything).
If i remove the while 1 and ‘end’ but leave the code between it works
perfectly.
It must be in how i’m envisioning how the thread works. I’m a java
programmer and this seems correct. Create the thread, define it’s
works then start the thread. The call to start should return and not
block. I’m not sure what it’s doing when i run the code with the
‘while’ statement.

Thanks for your help.

#load “ListenerList.rb”
require “socket”

class MovingPartsServer

def initialize()
	# do nothing yet
	#@listeners = ListenerList.new();
	# initialize the UDP socket
	puts " Open Socket"
	@socket = UDPSocket.open
	puts "Socket Created : "
	puts @socket
	@socket.bind(nil, 10003)
	puts "bound"

end

def run()
	puts  "run"
	@sThread = Thread.new(self) { |server|
		while 1
			puts "in thread"
			rcv = @socket.recvfrom(64)
			puts rcv

@listeners.AddListener rcv[0]

puts @listeners

		end
	}
	return @sThread
end

end

puts “Start”
server = MovingPartsServer.new;
puts “Start Server Thread”
sThread = server.run();

puts “start client”
UDPSocket.open.send(“ad hoc”, 0, ‘localhost’, 10003)
puts “end client”
sThread.join