Created
June 23, 2014 13:01
-
-
Save moomindani/9fd2f1c33f1ba8652476 to your computer and use it in GitHub Desktop.
Sending mcast
This file contains 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
#!/usr/bin/ruby | |
require "socket" | |
require "ipaddr" | |
udps = UDPSocket.open() | |
saddr = Socket.pack_sockaddr_in(10000, "239.192.1.2") | |
mif = IPAddr.new("172.31.4.93").hton | |
udps.setsockopt(Socket::IPPROTO_IP, Socket::IP_MULTICAST_IF, mif) | |
udps.send("HELLO", 0, saddr) | |
udps.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment