multicast 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/bin/mclisten +2 -27
- data/lib/multicast/listener.rb +3 -4
- data/lib/multicast/message.rb +13 -0
- data/lib/multicast.rb +1 -0
- data/multicast.gemspec +3 -2
- metadata +5 -4
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/bin/mclisten
CHANGED
@@ -48,31 +48,6 @@ puts "==== Multicast Listener ====\n"
|
|
48
48
|
listener = Multicast::Listener.new(:group => Choice.choices[:group], :port => Choice.choices[:port])
|
49
49
|
puts "---> Joining #{Choice.choices[:group]}:#{Choice.choices[:port]}"
|
50
50
|
|
51
|
-
listener.listen do |
|
52
|
-
puts "---> [#{
|
51
|
+
listener.listen do |message|
|
52
|
+
puts "---> [#{message.hostname} / #{message.ip}:#{message.port} (#{message.message.size} bytes)] #{message.message}"
|
53
53
|
end
|
54
|
-
|
55
|
-
|
56
|
-
# puts "==== Multicast Listener ====\n"
|
57
|
-
#
|
58
|
-
# multicast_group = Choice.choices[:group]
|
59
|
-
# port = Choice.choices[:port]
|
60
|
-
# ip = IPAddr.new(multicast_group).hton + IPAddr.new("0.0.0.0").hton
|
61
|
-
# puts "---> Joining #{multicast_group}:#{port}"
|
62
|
-
# sock = UDPSocket.new
|
63
|
-
# sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ip)
|
64
|
-
# sock.bind(Socket::INADDR_ANY, port)
|
65
|
-
#
|
66
|
-
# loop do
|
67
|
-
# begin
|
68
|
-
# msg, info = sock.recvfrom(1024)
|
69
|
-
# #puts "MSG: #{msg} from #{info[2]} (#{info[3]})/#{info[1]} len #{msg.size}"
|
70
|
-
# puts "---> [#{info[2]} / #{info[3]}:#{info[1]} (#{msg.size} bytes)] #{msg}"
|
71
|
-
#
|
72
|
-
# rescue Interrupt
|
73
|
-
# sock.close
|
74
|
-
# puts "\n---> Exiting"
|
75
|
-
# exit
|
76
|
-
# end
|
77
|
-
#
|
78
|
-
# end
|
data/lib/multicast/listener.rb
CHANGED
@@ -16,10 +16,9 @@ module Multicast
|
|
16
16
|
|
17
17
|
loop do
|
18
18
|
begin
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
yield(msg, info)
|
19
|
+
msg, info = sock.recvfrom(1024)
|
20
|
+
message = Message.new(:message => msg, :hostname => info[2], :ip => info[3], :port => info[1])
|
21
|
+
yield(message)
|
23
22
|
|
24
23
|
rescue Interrupt
|
25
24
|
sock.close
|
data/lib/multicast.rb
CHANGED
data/multicast.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{multicast}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marshall Huss"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-21}
|
13
13
|
s.description = %q{Multicasting in Ruby}
|
14
14
|
s.email = %q{mwhuss@gmail.com}
|
15
15
|
s.executables = ["mclisten", "mcsend"]
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"bin/mcsend",
|
29
29
|
"lib/multicast.rb",
|
30
30
|
"lib/multicast/listener.rb",
|
31
|
+
"lib/multicast/message.rb",
|
31
32
|
"lib/multicast/sender.rb",
|
32
33
|
"multicast.gemspec",
|
33
34
|
"test/helper.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multicast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marshall Huss
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-21 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- bin/mcsend
|
70
70
|
- lib/multicast.rb
|
71
71
|
- lib/multicast/listener.rb
|
72
|
+
- lib/multicast/message.rb
|
72
73
|
- lib/multicast/sender.rb
|
73
74
|
- multicast.gemspec
|
74
75
|
- test/helper.rb
|