Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'socket'
- SERVER = "143.60.60.29"
- PORT = "12345"
- $app = Shoes.app do
- # => background(gradient('#CFF', '#FFF'))
- @output = stack(:heigth => 600, :width => 450, :margin => 10)
- def display text
- @output.append do
- para text
- end
- end
- box = edit_box
- button "Send" do
- $chat.send(box.text, 0, SERVER, PORT)
- end
- end
- $chat = UDPSocket.new
- $chat.bind("0.0.0.0", PORT)
- Thread.new do
- $chat.send("HELO", 0, SERVER, PORT)
- while !nil
- input, sender = $chat.recvfrom(255)
- if /PIN/.match(input)
- $chat.send("HI", 0, SERVER, PORT)
- else
- $app.display(input)
- end
- end
- end
Add Comment
Please, Sign In to add comment