How do I send a message to a udp socket in Ruby 1.8.7 -


i able send message udp socket in ruby 1.9x. need make backwards compatible ruby 1.8.7, not able find documentation on how this. here's have 1.9.x:

require 'socket' socket = socket.new(:inet, :dgram) addr = socket.sockaddr_in(udp_port, udp_host) socket.connect_nonblock addr socket.send(some_json_string, 0) socket.close 

this works in 1.8.7:

socket = udpsocket.new socket.send(payload, 0, udp_host, udp_port) socket.close 

Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -