Last active
November 7, 2016 16:25
-
-
Save boxofrad/b5e6c924a262196cbc294c5a54e22ea5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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