Skip to content

Instantly share code, notes, and snippets.

@boxofrad
Last active November 7, 2016 16:25
Show Gist options
  • Save boxofrad/b5e6c924a262196cbc294c5a54e22ea5 to your computer and use it in GitHub Desktop.
Save boxofrad/b5e6c924a262196cbc294c5a54e22ea5 to your computer and use it in GitHub Desktop.
require 'socket'
BUFFER_SIZE = 1024
socket = UDPSocket.new
socket.bind('192.168.33.10', 4321)
loop do
message, sender = socket.recvfrom(BUFFER_SIZE)
port = sender[1]
host = sender[2]
socket.send(message.upcase, 0, host, port)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment